You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2018/11/05 18:54:43 UTC

[log4j] Better time values in config files.

Hi All:

Today in appenders like the JMS Appender you can specify time values like
the setting reconnectIntervalMillis="5000"; same idea with the mysterious
Configuration monitorInterval which is specified in seconds (how would you
know that without digging in the docs? ;-)

What I'd like to see instead is the ability to say reconnectInterval="5
SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute name.

The scale word is a java.util.concurrent.TimeUnit enum name (with, say, an
optional "S" at the end). I'm not thinking about localization ATM, just use
the TimeUnit enum names.

Over in Apache HttpComponents HttpCore, I created the very handy TimeValue
class for this purpose which holds a value and a TimeUnit:
https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java

Then instead of passing around opaque longs and ints around the code, you
pass arounds TimeValues.

In either 2.x or 3.x, I'd like to copy this class and use it.

Thoughts?

Gary

PS: In HttpCore, TimeValue also has a subclass Timeout.

Re: [log4j] Better time values in config files.

Posted by Matt Sicker <bo...@gmail.com>.
Yeah, that format and library is designed around Java in mind and Scala as
a downstream user (unlike most Lightbend things which are Scala-first).

On Mon, 5 Nov 2018 at 15:03, Gary Gregory <ga...@gmail.com> wrote:

> On Mon, Nov 5, 2018 at 2:02 PM Gary Gregory <ga...@gmail.com>
> wrote:
>
> > On Mon, Nov 5, 2018 at 1:59 PM Matt Sicker <bo...@gmail.com> wrote:
> >
> >> I like the HOCON format for duration values:
> >>
> https://github.com/lightbend/config/blob/master/HOCON.md#duration-format
> >
> >
> > That looks easy to map to Java TimeUnit.
> >
>
> I could see augmenting HttpCore's TimeValue to support those.
>
> Gary
>
>
> >
> > Gary
> >
> >
> >>
> >>
> >> On Mon, 5 Nov 2018 at 14:53, Gary Gregory <ga...@gmail.com>
> wrote:
> >>
> >> > On Mon, Nov 5, 2018 at 1:50 PM Ralph Goers <
> ralph.goers@dslextreme.com>
> >> > wrote:
> >> >
> >> > > I have no problem with this but would think it would be something we
> >> > would
> >> > > want to do in 3.0 and not 2.x. Rather than to keep introducing
> >> features
> >> > to
> >> > > 2.x I’d like to concentrate a bit on figuring out what things really
> >> need
> >> > > to be changed for a 3.0 release and adding new significant features
> >> > there.
> >> > >
> >> >
> >> > That's fine with me.
> >> >
> >> > Gary
> >> >
> >> >
> >> > > Ralph
> >> > >
> >> > > > On Nov 5, 2018, at 11:54 AM, Gary Gregory <garydgregory@gmail.com
> >
> >> > > wrote:
> >> > > >
> >> > > > Hi All:
> >> > > >
> >> > > > Today in appenders like the JMS Appender you can specify time
> values
> >> > like
> >> > > > the setting reconnectIntervalMillis="5000"; same idea with the
> >> > mysterious
> >> > > > Configuration monitorInterval which is specified in seconds (how
> >> would
> >> > > you
> >> > > > know that without digging in the docs? ;-)
> >> > > >
> >> > > > What I'd like to see instead is the ability to say
> >> reconnectInterval="5
> >> > > > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled
> >> attribute
> >> > > name.
> >> > > >
> >> > > > The scale word is a java.util.concurrent.TimeUnit enum name (with,
> >> say,
> >> > > an
> >> > > > optional "S" at the end). I'm not thinking about localization ATM,
> >> just
> >> > > use
> >> > > > the TimeUnit enum names.
> >> > > >
> >> > > > Over in Apache HttpComponents HttpCore, I created the very handy
> >> > > TimeValue
> >> > > > class for this purpose which holds a value and a TimeUnit:
> >> > > >
> >> > >
> >> >
> >>
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> >> > > >
> >> > > > Then instead of passing around opaque longs and ints around the
> >> code,
> >> > you
> >> > > > pass arounds TimeValues.
> >> > > >
> >> > > > In either 2.x or 3.x, I'd like to copy this class and use it.
> >> > > >
> >> > > > Thoughts?
> >> > > >
> >> > > > Gary
> >> > > >
> >> > > > PS: In HttpCore, TimeValue also has a subclass Timeout.
> >> > >
> >> > >
> >> > >
> >> >
> >>
> >>
> >> --
> >> Matt Sicker <bo...@gmail.com>
> >>
> >
>


-- 
Matt Sicker <bo...@gmail.com>

Re: [log4j] Better time values in config files.

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Nov 5, 2018 at 2:02 PM Gary Gregory <ga...@gmail.com> wrote:

> On Mon, Nov 5, 2018 at 1:59 PM Matt Sicker <bo...@gmail.com> wrote:
>
>> I like the HOCON format for duration values:
>> https://github.com/lightbend/config/blob/master/HOCON.md#duration-format
>
>
> That looks easy to map to Java TimeUnit.
>

I could see augmenting HttpCore's TimeValue to support those.

Gary


>
> Gary
>
>
>>
>>
>> On Mon, 5 Nov 2018 at 14:53, Gary Gregory <ga...@gmail.com> wrote:
>>
>> > On Mon, Nov 5, 2018 at 1:50 PM Ralph Goers <ra...@dslextreme.com>
>> > wrote:
>> >
>> > > I have no problem with this but would think it would be something we
>> > would
>> > > want to do in 3.0 and not 2.x. Rather than to keep introducing
>> features
>> > to
>> > > 2.x I’d like to concentrate a bit on figuring out what things really
>> need
>> > > to be changed for a 3.0 release and adding new significant features
>> > there.
>> > >
>> >
>> > That's fine with me.
>> >
>> > Gary
>> >
>> >
>> > > Ralph
>> > >
>> > > > On Nov 5, 2018, at 11:54 AM, Gary Gregory <ga...@gmail.com>
>> > > wrote:
>> > > >
>> > > > Hi All:
>> > > >
>> > > > Today in appenders like the JMS Appender you can specify time values
>> > like
>> > > > the setting reconnectIntervalMillis="5000"; same idea with the
>> > mysterious
>> > > > Configuration monitorInterval which is specified in seconds (how
>> would
>> > > you
>> > > > know that without digging in the docs? ;-)
>> > > >
>> > > > What I'd like to see instead is the ability to say
>> reconnectInterval="5
>> > > > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled
>> attribute
>> > > name.
>> > > >
>> > > > The scale word is a java.util.concurrent.TimeUnit enum name (with,
>> say,
>> > > an
>> > > > optional "S" at the end). I'm not thinking about localization ATM,
>> just
>> > > use
>> > > > the TimeUnit enum names.
>> > > >
>> > > > Over in Apache HttpComponents HttpCore, I created the very handy
>> > > TimeValue
>> > > > class for this purpose which holds a value and a TimeUnit:
>> > > >
>> > >
>> >
>> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
>> > > >
>> > > > Then instead of passing around opaque longs and ints around the
>> code,
>> > you
>> > > > pass arounds TimeValues.
>> > > >
>> > > > In either 2.x or 3.x, I'd like to copy this class and use it.
>> > > >
>> > > > Thoughts?
>> > > >
>> > > > Gary
>> > > >
>> > > > PS: In HttpCore, TimeValue also has a subclass Timeout.
>> > >
>> > >
>> > >
>> >
>>
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>

Re: [log4j] Better time values in config files.

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Nov 5, 2018 at 1:59 PM Matt Sicker <bo...@gmail.com> wrote:

> I like the HOCON format for duration values:
> https://github.com/lightbend/config/blob/master/HOCON.md#duration-format


That looks easy to map to Java TimeUnit.

Gary


>
>
> On Mon, 5 Nov 2018 at 14:53, Gary Gregory <ga...@gmail.com> wrote:
>
> > On Mon, Nov 5, 2018 at 1:50 PM Ralph Goers <ra...@dslextreme.com>
> > wrote:
> >
> > > I have no problem with this but would think it would be something we
> > would
> > > want to do in 3.0 and not 2.x. Rather than to keep introducing features
> > to
> > > 2.x I’d like to concentrate a bit on figuring out what things really
> need
> > > to be changed for a 3.0 release and adding new significant features
> > there.
> > >
> >
> > That's fine with me.
> >
> > Gary
> >
> >
> > > Ralph
> > >
> > > > On Nov 5, 2018, at 11:54 AM, Gary Gregory <ga...@gmail.com>
> > > wrote:
> > > >
> > > > Hi All:
> > > >
> > > > Today in appenders like the JMS Appender you can specify time values
> > like
> > > > the setting reconnectIntervalMillis="5000"; same idea with the
> > mysterious
> > > > Configuration monitorInterval which is specified in seconds (how
> would
> > > you
> > > > know that without digging in the docs? ;-)
> > > >
> > > > What I'd like to see instead is the ability to say
> reconnectInterval="5
> > > > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute
> > > name.
> > > >
> > > > The scale word is a java.util.concurrent.TimeUnit enum name (with,
> say,
> > > an
> > > > optional "S" at the end). I'm not thinking about localization ATM,
> just
> > > use
> > > > the TimeUnit enum names.
> > > >
> > > > Over in Apache HttpComponents HttpCore, I created the very handy
> > > TimeValue
> > > > class for this purpose which holds a value and a TimeUnit:
> > > >
> > >
> >
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> > > >
> > > > Then instead of passing around opaque longs and ints around the code,
> > you
> > > > pass arounds TimeValues.
> > > >
> > > > In either 2.x or 3.x, I'd like to copy this class and use it.
> > > >
> > > > Thoughts?
> > > >
> > > > Gary
> > > >
> > > > PS: In HttpCore, TimeValue also has a subclass Timeout.
> > >
> > >
> > >
> >
>
>
> --
> Matt Sicker <bo...@gmail.com>
>

Re: [log4j] Better time values in config files.

Posted by Matt Sicker <bo...@gmail.com>.
I like the HOCON format for duration values:
https://github.com/lightbend/config/blob/master/HOCON.md#duration-format

On Mon, 5 Nov 2018 at 14:53, Gary Gregory <ga...@gmail.com> wrote:

> On Mon, Nov 5, 2018 at 1:50 PM Ralph Goers <ra...@dslextreme.com>
> wrote:
>
> > I have no problem with this but would think it would be something we
> would
> > want to do in 3.0 and not 2.x. Rather than to keep introducing features
> to
> > 2.x I’d like to concentrate a bit on figuring out what things really need
> > to be changed for a 3.0 release and adding new significant features
> there.
> >
>
> That's fine with me.
>
> Gary
>
>
> > Ralph
> >
> > > On Nov 5, 2018, at 11:54 AM, Gary Gregory <ga...@gmail.com>
> > wrote:
> > >
> > > Hi All:
> > >
> > > Today in appenders like the JMS Appender you can specify time values
> like
> > > the setting reconnectIntervalMillis="5000"; same idea with the
> mysterious
> > > Configuration monitorInterval which is specified in seconds (how would
> > you
> > > know that without digging in the docs? ;-)
> > >
> > > What I'd like to see instead is the ability to say reconnectInterval="5
> > > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute
> > name.
> > >
> > > The scale word is a java.util.concurrent.TimeUnit enum name (with, say,
> > an
> > > optional "S" at the end). I'm not thinking about localization ATM, just
> > use
> > > the TimeUnit enum names.
> > >
> > > Over in Apache HttpComponents HttpCore, I created the very handy
> > TimeValue
> > > class for this purpose which holds a value and a TimeUnit:
> > >
> >
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> > >
> > > Then instead of passing around opaque longs and ints around the code,
> you
> > > pass arounds TimeValues.
> > >
> > > In either 2.x or 3.x, I'd like to copy this class and use it.
> > >
> > > Thoughts?
> > >
> > > Gary
> > >
> > > PS: In HttpCore, TimeValue also has a subclass Timeout.
> >
> >
> >
>


-- 
Matt Sicker <bo...@gmail.com>

Re: [log4j] Better time values in config files.

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Nov 5, 2018 at 1:50 PM Ralph Goers <ra...@dslextreme.com>
wrote:

> I have no problem with this but would think it would be something we would
> want to do in 3.0 and not 2.x. Rather than to keep introducing features to
> 2.x I’d like to concentrate a bit on figuring out what things really need
> to be changed for a 3.0 release and adding new significant features there.
>

That's fine with me.

Gary


> Ralph
>
> > On Nov 5, 2018, at 11:54 AM, Gary Gregory <ga...@gmail.com>
> wrote:
> >
> > Hi All:
> >
> > Today in appenders like the JMS Appender you can specify time values like
> > the setting reconnectIntervalMillis="5000"; same idea with the mysterious
> > Configuration monitorInterval which is specified in seconds (how would
> you
> > know that without digging in the docs? ;-)
> >
> > What I'd like to see instead is the ability to say reconnectInterval="5
> > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute
> name.
> >
> > The scale word is a java.util.concurrent.TimeUnit enum name (with, say,
> an
> > optional "S" at the end). I'm not thinking about localization ATM, just
> use
> > the TimeUnit enum names.
> >
> > Over in Apache HttpComponents HttpCore, I created the very handy
> TimeValue
> > class for this purpose which holds a value and a TimeUnit:
> >
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> >
> > Then instead of passing around opaque longs and ints around the code, you
> > pass arounds TimeValues.
> >
> > In either 2.x or 3.x, I'd like to copy this class and use it.
> >
> > Thoughts?
> >
> > Gary
> >
> > PS: In HttpCore, TimeValue also has a subclass Timeout.
>
>
>

Re: [log4j] Better time values in config files.

Posted by Ralph Goers <ra...@dslextreme.com>.
I have no problem with this but would think it would be something we would want to do in 3.0 and not 2.x. Rather than to keep introducing features to 2.x I’d like to concentrate a bit on figuring out what things really need to be changed for a 3.0 release and adding new significant features there.

Ralph

> On Nov 5, 2018, at 11:54 AM, Gary Gregory <ga...@gmail.com> wrote:
> 
> Hi All:
> 
> Today in appenders like the JMS Appender you can specify time values like
> the setting reconnectIntervalMillis="5000"; same idea with the mysterious
> Configuration monitorInterval which is specified in seconds (how would you
> know that without digging in the docs? ;-)
> 
> What I'd like to see instead is the ability to say reconnectInterval="5
> SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute name.
> 
> The scale word is a java.util.concurrent.TimeUnit enum name (with, say, an
> optional "S" at the end). I'm not thinking about localization ATM, just use
> the TimeUnit enum names.
> 
> Over in Apache HttpComponents HttpCore, I created the very handy TimeValue
> class for this purpose which holds a value and a TimeUnit:
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> 
> Then instead of passing around opaque longs and ints around the code, you
> pass arounds TimeValues.
> 
> In either 2.x or 3.x, I'd like to copy this class and use it.
> 
> Thoughts?
> 
> Gary
> 
> PS: In HttpCore, TimeValue also has a subclass Timeout.



Re: [log4j] Better time values in config files.

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Nov 5, 2018 at 12:46 PM Matt Sicker <bo...@gmail.com> wrote:

> The Duration format is just ISO-8601. Problem is that nobody uses that part
> of the spec. :)
>

We use ISO-8601 to configure some files at work and it works, but it's a
bit ugly. I'm OK supporting both formats even. I just want a better format
than we have now.

Gary

>
> On Mon, 5 Nov 2018 at 13:33, Gary Gregory <ga...@gmail.com> wrote:
>
> > On Mon, Nov 5, 2018 at 12:12 PM Carter Kozak <c4...@gmail.com> wrote:
> >
> > > Big +1 for values with units.
> > > Unless we need to support this on 2.x, should we take advantage of
> > > java 8 java.time.Duration as our value type, and only implement the
> > > parser ourselves?
> > >
> >
> > I think that tracking as a Duration is OK. The only I am not super fond
> of
> > is that Duration parses only strings in the format PnDTnHnMn.nS so it's a
> > bit of a pain to say "5 SECONDS": "PT5S" is nice for machine generated
> > values but typo-prone for carbon-based units.
> >
> > Gary
> >
> >
> > > On Mon, Nov 5, 2018 at 1:54 PM Gary Gregory <ga...@gmail.com>
> > > wrote:
> > > >
> > > > Hi All:
> > > >
> > > > Today in appenders like the JMS Appender you can specify time values
> > like
> > > > the setting reconnectIntervalMillis="5000"; same idea with the
> > mysterious
> > > > Configuration monitorInterval which is specified in seconds (how
> would
> > > you
> > > > know that without digging in the docs? ;-)
> > > >
> > > > What I'd like to see instead is the ability to say
> reconnectInterval="5
> > > > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute
> > > name.
> > > >
> > > > The scale word is a java.util.concurrent.TimeUnit enum name (with,
> say,
> > > an
> > > > optional "S" at the end). I'm not thinking about localization ATM,
> just
> > > use
> > > > the TimeUnit enum names.
> > > >
> > > > Over in Apache HttpComponents HttpCore, I created the very handy
> > > TimeValue
> > > > class for this purpose which holds a value and a TimeUnit:
> > > >
> > >
> >
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> > > >
> > > > Then instead of passing around opaque longs and ints around the code,
> > you
> > > > pass arounds TimeValues.
> > > >
> > > > In either 2.x or 3.x, I'd like to copy this class and use it.
> > > >
> > > > Thoughts?
> > > >
> > > > Gary
> > > >
> > > > PS: In HttpCore, TimeValue also has a subclass Timeout.
> > >
> >
>
>
> --
> Matt Sicker <bo...@gmail.com>
>

Re: [log4j] Better time values in config files.

Posted by Matt Sicker <bo...@gmail.com>.
The Duration format is just ISO-8601. Problem is that nobody uses that part
of the spec. :)

On Mon, 5 Nov 2018 at 13:33, Gary Gregory <ga...@gmail.com> wrote:

> On Mon, Nov 5, 2018 at 12:12 PM Carter Kozak <c4...@gmail.com> wrote:
>
> > Big +1 for values with units.
> > Unless we need to support this on 2.x, should we take advantage of
> > java 8 java.time.Duration as our value type, and only implement the
> > parser ourselves?
> >
>
> I think that tracking as a Duration is OK. The only I am not super fond of
> is that Duration parses only strings in the format PnDTnHnMn.nS so it's a
> bit of a pain to say "5 SECONDS": "PT5S" is nice for machine generated
> values but typo-prone for carbon-based units.
>
> Gary
>
>
> > On Mon, Nov 5, 2018 at 1:54 PM Gary Gregory <ga...@gmail.com>
> > wrote:
> > >
> > > Hi All:
> > >
> > > Today in appenders like the JMS Appender you can specify time values
> like
> > > the setting reconnectIntervalMillis="5000"; same idea with the
> mysterious
> > > Configuration monitorInterval which is specified in seconds (how would
> > you
> > > know that without digging in the docs? ;-)
> > >
> > > What I'd like to see instead is the ability to say reconnectInterval="5
> > > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute
> > name.
> > >
> > > The scale word is a java.util.concurrent.TimeUnit enum name (with, say,
> > an
> > > optional "S" at the end). I'm not thinking about localization ATM, just
> > use
> > > the TimeUnit enum names.
> > >
> > > Over in Apache HttpComponents HttpCore, I created the very handy
> > TimeValue
> > > class for this purpose which holds a value and a TimeUnit:
> > >
> >
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> > >
> > > Then instead of passing around opaque longs and ints around the code,
> you
> > > pass arounds TimeValues.
> > >
> > > In either 2.x or 3.x, I'd like to copy this class and use it.
> > >
> > > Thoughts?
> > >
> > > Gary
> > >
> > > PS: In HttpCore, TimeValue also has a subclass Timeout.
> >
>


-- 
Matt Sicker <bo...@gmail.com>

Re: [log4j] Better time values in config files.

Posted by Carter Kozak <c4...@gmail.com>.
I agree that we shouldn't use the Duration.parse functionality, but
perhaps we can define our own parser to convert strings into Duration
objects similar to the parse function in TimeValue. Thoughts?
On Mon, Nov 5, 2018 at 2:33 PM Gary Gregory <ga...@gmail.com> wrote:
>
> On Mon, Nov 5, 2018 at 12:12 PM Carter Kozak <c4...@gmail.com> wrote:
>
> > Big +1 for values with units.
> > Unless we need to support this on 2.x, should we take advantage of
> > java 8 java.time.Duration as our value type, and only implement the
> > parser ourselves?
> >
>
> I think that tracking as a Duration is OK. The only I am not super fond of
> is that Duration parses only strings in the format PnDTnHnMn.nS so it's a
> bit of a pain to say "5 SECONDS": "PT5S" is nice for machine generated
> values but typo-prone for carbon-based units.
>
> Gary
>
>
> > On Mon, Nov 5, 2018 at 1:54 PM Gary Gregory <ga...@gmail.com>
> > wrote:
> > >
> > > Hi All:
> > >
> > > Today in appenders like the JMS Appender you can specify time values like
> > > the setting reconnectIntervalMillis="5000"; same idea with the mysterious
> > > Configuration monitorInterval which is specified in seconds (how would
> > you
> > > know that without digging in the docs? ;-)
> > >
> > > What I'd like to see instead is the ability to say reconnectInterval="5
> > > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute
> > name.
> > >
> > > The scale word is a java.util.concurrent.TimeUnit enum name (with, say,
> > an
> > > optional "S" at the end). I'm not thinking about localization ATM, just
> > use
> > > the TimeUnit enum names.
> > >
> > > Over in Apache HttpComponents HttpCore, I created the very handy
> > TimeValue
> > > class for this purpose which holds a value and a TimeUnit:
> > >
> > https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> > >
> > > Then instead of passing around opaque longs and ints around the code, you
> > > pass arounds TimeValues.
> > >
> > > In either 2.x or 3.x, I'd like to copy this class and use it.
> > >
> > > Thoughts?
> > >
> > > Gary
> > >
> > > PS: In HttpCore, TimeValue also has a subclass Timeout.
> >

Re: [log4j] Better time values in config files.

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Nov 5, 2018 at 12:12 PM Carter Kozak <c4...@gmail.com> wrote:

> Big +1 for values with units.
> Unless we need to support this on 2.x, should we take advantage of
> java 8 java.time.Duration as our value type, and only implement the
> parser ourselves?
>

I think that tracking as a Duration is OK. The only I am not super fond of
is that Duration parses only strings in the format PnDTnHnMn.nS so it's a
bit of a pain to say "5 SECONDS": "PT5S" is nice for machine generated
values but typo-prone for carbon-based units.

Gary


> On Mon, Nov 5, 2018 at 1:54 PM Gary Gregory <ga...@gmail.com>
> wrote:
> >
> > Hi All:
> >
> > Today in appenders like the JMS Appender you can specify time values like
> > the setting reconnectIntervalMillis="5000"; same idea with the mysterious
> > Configuration monitorInterval which is specified in seconds (how would
> you
> > know that without digging in the docs? ;-)
> >
> > What I'd like to see instead is the ability to say reconnectInterval="5
> > SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute
> name.
> >
> > The scale word is a java.util.concurrent.TimeUnit enum name (with, say,
> an
> > optional "S" at the end). I'm not thinking about localization ATM, just
> use
> > the TimeUnit enum names.
> >
> > Over in Apache HttpComponents HttpCore, I created the very handy
> TimeValue
> > class for this purpose which holds a value and a TimeUnit:
> >
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
> >
> > Then instead of passing around opaque longs and ints around the code, you
> > pass arounds TimeValues.
> >
> > In either 2.x or 3.x, I'd like to copy this class and use it.
> >
> > Thoughts?
> >
> > Gary
> >
> > PS: In HttpCore, TimeValue also has a subclass Timeout.
>

Re: [log4j] Better time values in config files.

Posted by Carter Kozak <c4...@gmail.com>.
Big +1 for values with units.
Unless we need to support this on 2.x, should we take advantage of
java 8 java.time.Duration as our value type, and only implement the
parser ourselves?
On Mon, Nov 5, 2018 at 1:54 PM Gary Gregory <ga...@gmail.com> wrote:
>
> Hi All:
>
> Today in appenders like the JMS Appender you can specify time values like
> the setting reconnectIntervalMillis="5000"; same idea with the mysterious
> Configuration monitorInterval which is specified in seconds (how would you
> know that without digging in the docs? ;-)
>
> What I'd like to see instead is the ability to say reconnectInterval="5
> SECONDS" and monitorInterval="2 MINUTES". Note the unscaled attribute name.
>
> The scale word is a java.util.concurrent.TimeUnit enum name (with, say, an
> optional "S" at the end). I'm not thinking about localization ATM, just use
> the TimeUnit enum names.
>
> Over in Apache HttpComponents HttpCore, I created the very handy TimeValue
> class for this purpose which holds a value and a TimeUnit:
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
>
> Then instead of passing around opaque longs and ints around the code, you
> pass arounds TimeValues.
>
> In either 2.x or 3.x, I'd like to copy this class and use it.
>
> Thoughts?
>
> Gary
>
> PS: In HttpCore, TimeValue also has a subclass Timeout.