You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "SMITH, CURTIS" <cs...@att.com> on 2013/07/23 17:39:31 UTC

Confused: want low latency: do I need BOTH async logger AND async appender??

http://logging.apache.org/log4j/2.x/manual/async.html

This URL describes that v2 has both async logger and async appender.   What is the suggested config for an embedded situation where I want low latency, nothing fancy?

I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.

System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
System.setProperty("log4j2.disable.jmx", "true");               // saves on a jmx jar and we don't use JMX anyway

Tnx curt

Curt Smith
AT&T Digital Life
DLC Software Development
404-499-7013
(cell) 678-365-6508




Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Ralph Goers <ra...@dslextreme.com>.
That email was from a while ago.

I think I just came up with another attribute for the JMX element.  I'll have to look at the status logger but I believe it is always creating a StatusData object and putting it in a ring buffer so they can be printed later.  This will actually create a lot of objects and will impact performance.  So we will want to add a statusLevel attribute to the JMX element to specify what the level is on the events that should be added to the buffer.  

It was actually kind of cool though as the person doing the performance test looked at the JMX stats and even though the status was set to error in the configuration they had lots of debug messages in JMX that were quite helpful to verify a misconfiguration.

Ralph

On Jul 23, 2013, at 3:17 PM, Remko Popma wrote:

> Understood about CamelCase, not a problem.
> Maybe AsyncLoggers is a better element name anyway. How does this look?
>> <configuration level="warn" Log4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector">
>>   <AsyncLoggers exceptionHandler="my.custom.Handler" ringBufferSize="128" waitStrategy="Block" />
>>   <jmx enabled="true" />
>> </configuration>
> Sorry, I don't remember what email from Simo you are referring to.
> 
> 
> From: Gary Gregory <ga...@gmail.com>
> To: Log4J Developers List <lo...@logging.apache.org> 
> Sent: Wednesday, July 24, 2013 7:07 AM
> Subject: Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??
> 
> What is up with the dashes in element names? That is unsightly IMO. I know that we have some - IMO unnecessary  - flexibility in our config code to make XML case insensitive but dashes we have in there now make it impossible to make the XML look decent. If it were just me I would use CamelCase for element names (like class names) and camelCase for attribute names (like instance variable names). 
> 
> Simo has emailed about a different approach to configuration. Does anyone have comments on that btw? I know, I should start a different thread...
> 
> Gary
> 
> On Jul 23, 2013, at 17:57, Remko Popma <re...@yahoo.com> wrote:
> 
>> After looking at your changes for LOG4J2-318 to add the shutdownHookEnabled attribute I understand a bit better.
>> 
>> Here is a list of properties that can be used to configure AsyncLoggers when all loggers are Async:
>> * Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>> * AsyncLogger.ExceptionHandler
>> * AsyncLogger.RingBufferSize
>> * AsyncLogger.WaitStrategy
>> * log4j.Clock - currently only used for timestamping RingBufferLogEvents. Should all LogEvents 
>> 
>> The following system properties can be used to configure mixed Async Loggers:
>> * AsyncLoggerConfig.ExceptionHandler	
>> * AsyncLoggerConfig.RingBufferSize
>> * AsyncLoggerConfig.WaitStrategy
>> 
>> For JMX there is only the one "disable" property, which Gary suggested to make into an element rather than an attribute to future-proof it.
>> 
>> So, should the result look something like this?
>> 
>> <configuration level="warn" Log4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector">
>>   <async-configuration exceptionHandler="my.custom.Handler" ringBufferSize="128" waitStrategy="Block" />
>>   <jmx enabled="true" />
>> </configuration>
>> 
>> 
>> From: Ralph Goers <ra...@dslextreme.com>
>> To: Log4J Developers List <lo...@logging.apache.org> 
>> Sent: Wednesday, July 24, 2013 2:38 AM
>> Subject: Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??
>> 
>> What don't you know?  I'd be happy to help with that :-)
>> 
>> Ralph
>> 
>> 
>> On Jul 23, 2013, at 9:20 AM, Remko Popma wrote:
>> 
>> > I wouldn't mind doing this but don't know how. 
>> > 
>> > Remko
>> > 
>> > Sent from my iPhone
>> > 
>> > On 2013/07/24, at 0:46, Nick Williams <ni...@nicholaswilliams.net> wrote:
>> > 
>> >> I don't know the answer to this guy's question on the user's list, but it brought up something interesting that we need to look at. Already (in a separate issue) we have talked about needing a config element for JMX so that you don't have to use properties in this manner. IMO, if there's not a way to set these AsyncLogger configuration options in log4j2.xml/json, that needs to be added, too. You should never have to do System.setProperty (or -D on the command line) to get Log4j configured properly.
>> >> 
>> >> My $0.02.
>> >> 
>> >> Nick
>> >> 
>> >> On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
>> >> 
>> >>> http://logging.apache.org/log4j/2.x/manual/async.html
>> >>> 
>> >>> This URL describes that v2 has both async logger and async appender.  What is the suggested config for an embedded situation where I want low latency, nothing fancy?
>> >>> 
>> >>> I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.
>> >>> 
>> >>> System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
>> >>> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
>> >>> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
>> >>> System.setProperty("log4j2.disable.jmx", "true");              // saves on a jmx jar and we don't use JMX anyway
>> >>> 
>> >>> Tnx curt
>> >>> 
>> >>> Curt Smith
>> >>> AT&T Digital Life
>> >>> DLC Software Development
>> >>> 404-499-7013
>> >>> (cell) 678-365-6508
>> >> 
>> >> 
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> >> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> >> 
>> > 
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> > For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> > 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
>> 
> 
> 


Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Gary Gregory <ga...@gmail.com>.
On Tue, Jul 23, 2013 at 6:17 PM, Remko Popma <re...@yahoo.com> wrote:

> Understood about CamelCase, not a problem.
> Maybe AsyncLoggers is a better element name anyway. How does this look?
>
> <configuration level="warn"
> Log4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector">
>   <AsyncLoggers exceptionHandler="my.custom.Handler" ringBufferSize="128"
> waitStrategy="Block" />
>   <jmx enabled="true" />
> </configuration>
>
> Sorry, I don't remember what email from Simo you are referring to.
>

Please read
https://mail-archives.apache.org/mod_mbox/logging-log4j-dev/201306.mbox/%3CCAAqLGLNpLiZRP_8SJXcttYutVHJFNuqNxvr3HruaLpKaG12FvA@mail.gmail.com%3E

Gary


>
>
>   ------------------------------
>  *From:* Gary Gregory <ga...@gmail.com>
>
> *To:* Log4J Developers List <lo...@logging.apache.org>
> *Sent:* Wednesday, July 24, 2013 7:07 AM
>
> *Subject:* Re: Config additions, WAS: Confused: want low latency: do I
> need BOTH async logger AND async appender??
>
> What is up with the dashes in element names? That is unsightly IMO. I know
> that we have some - IMO unnecessary  - flexibility in our config code to
> make XML case insensitive but dashes we have in there now make it
> impossible to make the XML look decent. If it were just me I would use
> CamelCase for element names (like class names) and camelCase for attribute
> names (like instance variable names).
>
> Simo has emailed about a different approach to configuration. Does anyone
> have comments on that btw? I know, I should start a different thread...
>
> Gary
>
> On Jul 23, 2013, at 17:57, Remko Popma <re...@yahoo.com> wrote:
>
> After looking at your changes for LOG4J2-318<https://issues.apache.org/jira/browse/LOG4J2-318> to
> add the shutdownHookEnabled attribute I understand a bit better.
>
> Here is a list of properties that can be used to configure AsyncLoggers
> when all loggers are Async:
> *
> Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
> * AsyncLogger.ExceptionHandler
> * AsyncLogger.RingBufferSize
> * AsyncLogger.WaitStrategy
> * log4j.Clock - currently only used for timestamping RingBufferLogEvents.
> Should all LogEvents
>
> The following system properties can be used to configure mixed Async
> Loggers:
> * AsyncLoggerConfig.ExceptionHandler
> * AsyncLoggerConfig.RingBufferSize
> * AsyncLoggerConfig.WaitStrategy
>
> For JMX there is only the one "disable" property, which Gary suggested to
> make into an element rather than an attribute to future-proof it.
>
> So, should the result look something like this?
>
> <configuration level="warn"
> Log4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector">
>   <async-configuration exceptionHandler="my.custom.Handler" ringBufferSize="128"
> waitStrategy="Block" />
>   <jmx enabled="true" />
> </configuration>
>
>
>  *From:* Ralph Goers <ra...@dslextreme.com>
> *To:* Log4J Developers List <lo...@logging.apache.org>
> *Sent:* Wednesday, July 24, 2013 2:38 AM
> *Subject:* Re: Config additions, WAS: Confused: want low latency: do I
> need BOTH async logger AND async appender??
>
> What don't you know?  I'd be happy to help with that :-)
>
> Ralph
>
>
> On Jul 23, 2013, at 9:20 AM, Remko Popma wrote:
>
> > I wouldn't mind doing this but don't know how.
> >
> > Remko
> >
> > Sent from my iPhone
> >
> > On 2013/07/24, at 0:46, Nick Williams <ni...@nicholaswilliams.net>
> wrote:
> >
> >> I don't know the answer to this guy's question on the user's list, but
> it brought up something interesting that we need to look at. Already (in a
> separate issue) we have talked about needing a config element for JMX so
> that you don't have to use properties in this manner. IMO, if there's not a
> way to set these AsyncLogger configuration options in log4j2.xml/json, that
> needs to be added, too. You should never have to do System.setProperty (or
> -D on the command line) to get Log4j configured properly.
> >>
> >> My $0.02.
> >>
> >> Nick
> >>
> >> On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
> >>
> >>> http://logging.apache.org/log4j/2.x/manual/async.html
> >>>
> >>> This URL describes that v2 has both async logger and async appender.
> What is the suggested config for an embedded situation where I want low
> latency, nothing fancy?
> >>>
> >>> I've had do this in code since we don't own the cmd line:  OSGi and
> system vendor owns the box and java command line.
> >>>
> >>> System.setProperty("AsyncLoggerContextSelector",
> "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
> >>> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min
> size permissable to keep memory low
> >>> System.setProperty("AsyncLogger.WaitStrategy", "Block");        //
> less CPU, better for embedded env
> >>> System.setProperty("log4j2.disable.jmx", "true");              //
> saves on a jmx jar and we don't use JMX anyway
> >>>
> >>> Tnx curt
> >>>
> >>> Curt Smith
> >>> AT&T Digital Life
> >>> DLC Software Development
> >>> 404-499-7013
> >>> (cell) 678-365-6508
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> >> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-dev-help@logging.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Remko Popma <re...@yahoo.com>.
Understood about CamelCase, not a problem.
Maybe AsyncLoggers is a better element name anyway. How does this look?
<configuration level="warn" Log4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector">
>  <AsyncLoggers exceptionHandler="my.custom.Handler" ringBufferSize="128" waitStrategy="Block" />
>  <jmx enabled="true" />
></configuration>
Sorry, I don't remember what email from Simo you are referring to.



________________________________
 From: Gary Gregory <ga...@gmail.com>
To: Log4J Developers List <lo...@logging.apache.org> 
Sent: Wednesday, July 24, 2013 7:07 AM
Subject: Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??
 


What is up with the dashes in element names? That is unsightly IMO. I know that we have some - IMO unnecessary  - flexibility in our config code to make XML case insensitive but dashes we have in there now make it impossible to make the XML look decent. If it were just me I would use CamelCase for element names (like class names) and camelCase for attribute names (like instance variable names). 

Simo has emailed about a different approach to configuration. Does anyone have comments on that btw? I know, I should start a different thread...

Gary

On Jul 23, 2013, at 17:57, Remko Popma <re...@yahoo.com> wrote:


After looking at your changes for LOG4J2-318 to add the shutdownHookEnabled attribute I understand a bit better.
>
>
>Here is a list of properties that can be used to configure AsyncLoggers when all loggers are Async:
>* Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>* AsyncLogger.ExceptionHandler
>* AsyncLogger.RingBufferSize
>* AsyncLogger.WaitStrategy
>* log4j.Clock - currently only used for timestamping RingBufferLogEvents. Should all LogEvents 
>
>
>The following system properties can be used to configure mixed Async Loggers:
>* AsyncLoggerConfig.ExceptionHandler
>* AsyncLoggerConfig.RingBufferSize
>* AsyncLoggerConfig.WaitStrategy
>
>
>For JMX there is only the one "disable" property, which Gary suggested to make into an element rather than an attribute to future-proof it.
>
>
>So, should the result look something like this?
>
>
><configuration level="warn" Log4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector">
>  <async-configuration exceptionHandler="my.custom.Handler" ringBufferSize="128" waitStrategy="Block" />
>  <jmx enabled="true" />
></configuration>
>
>
>
>
>From: Ralph Goers <ra...@dslextreme.com>
>To: Log4J Developers List <lo...@logging.apache.org> 
>Sent: Wednesday, July 24, 2013 2:38 AM
>Subject: Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??
> 
>
>What don't you know?  I'd be happy to help with that :-)
>
>Ralph
>
>
>On Jul 23, 2013, at 9:20 AM, Remko Popma wrote:
>
>> I wouldn't mind doing this but don't know
 how. 
>> 
>> Remko
>> 
>> Sent from my iPhone
>> 
>> On 2013/07/24, at 0:46, Nick Williams <ni...@nicholaswilliams.net> wrote:
>> 
>>> I don't know the answer to this guy's question on the user's list, but it brought up something interesting that we need to look at. Already (in a separate issue) we have talked about needing a config element for JMX so that you don't have to use properties in this manner. IMO, if there's not a way to set these AsyncLogger configuration options in log4j2.xml/json, that needs to be added, too. You should never have to do System.setProperty (or -D on the command line) to get Log4j configured properly.
>>> 
>>> My $0.02.
>>> 
>>> Nick
>>> 
>>> On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
>>> 
>>>> http://logging.apache.org/log4j/2.x/manual/async.html
>>>> 
>>>> This URL describes that v2 has both async logger and async appender.   What is the suggested config for an embedded situation where I want low latency, nothing fancy?
>>>> 
>>>> I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.
>>>> 
>>>> System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
>>>> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
>>>> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
>>>>
 System.setProperty("log4j2.disable.jmx", "true");               // saves on a jmx jar and we don't use JMX anyway
>>>> 
>>>> Tnx curt
>>>> 
>>>> Curt Smith
>>>> AT&T Digital Life
>>>> DLC Software Development
>>>> 404-499-7013
>>>> (cell) 678-365-6508
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>> 
>> 
>>
 ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
>

Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Gary Gregory <ga...@gmail.com>.
What is up with the dashes in element names? That is unsightly IMO. I know
that we have some - IMO unnecessary  - flexibility in our config code to
make XML case insensitive but dashes we have in there now make it
impossible to make the XML look decent. If it were just me I would use
CamelCase for element names (like class names) and camelCase for attribute
names (like instance variable names).

Simo has emailed about a different approach to configuration. Does anyone
have comments on that btw? I know, I should start a different thread...

Gary

On Jul 23, 2013, at 17:57, Remko Popma <re...@yahoo.com> wrote:

After looking at your changes for
LOG4J2-318<https://issues.apache.org/jira/browse/LOG4J2-318> to
add the shutdownHookEnabled attribute I understand a bit better.

Here is a list of properties that can be used to configure AsyncLoggers
when all loggers are Async:
*
Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
* AsyncLogger.ExceptionHandler
* AsyncLogger.RingBufferSize
* AsyncLogger.WaitStrategy
* log4j.Clock - currently only used for timestamping RingBufferLogEvents.
Should all LogEvents

The following system properties can be used to configure mixed Async
Loggers:
* AsyncLoggerConfig.ExceptionHandler
* AsyncLoggerConfig.RingBufferSize
* AsyncLoggerConfig.WaitStrategy

For JMX there is only the one "disable" property, which Gary suggested to
make into an element rather than an attribute to future-proof it.

So, should the result look something like this?

<configuration level="warn"
Log4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector">
  <async-configuration exceptionHandler="my.custom.Handler"
ringBufferSize="128"
waitStrategy="Block" />
  <jmx enabled="true" />
</configuration>


 *From:* Ralph Goers <ra...@dslextreme.com>
*To:* Log4J Developers List <lo...@logging.apache.org>
*Sent:* Wednesday, July 24, 2013 2:38 AM
*Subject:* Re: Config additions, WAS: Confused: want low latency: do I need
BOTH async logger AND async appender??

What don't you know?  I'd be happy to help with that :-)

Ralph


On Jul 23, 2013, at 9:20 AM, Remko Popma wrote:

> I wouldn't mind doing this but don't know how.
>
> Remko
>
> Sent from my iPhone
>
> On 2013/07/24, at 0:46, Nick Williams <ni...@nicholaswilliams.net>
wrote:
>
>> I don't know the answer to this guy's question on the user's list, but
it brought up something interesting that we need to look at. Already (in a
separate issue) we have talked about needing a config element for JMX so
that you don't have to use properties in this manner. IMO, if there's not a
way to set these AsyncLogger configuration options in log4j2.xml/json, that
needs to be added, too. You should never have to do System.setProperty (or
-D on the command line) to get Log4j configured properly.
>>
>> My $0.02.
>>
>> Nick
>>
>> On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
>>
>>> http://logging.apache.org/log4j/2.x/manual/async.html
>>>
>>> This URL describes that v2 has both async logger and async appender.
What is the suggested config for an embedded situation where I want low
latency, nothing fancy?
>>>
>>> I've had do this in code since we don't own the cmd line:  OSGi and
system vendor owns the box and java command line.
>>>
>>> System.setProperty("AsyncLoggerContextSelector",
"org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
>>> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min
size permissable to keep memory low
>>> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less
CPU, better for embedded env
>>> System.setProperty("log4j2.disable.jmx", "true");              // saves
on a jmx jar and we don't use JMX anyway
>>>
>>> Tnx curt
>>>
>>> Curt Smith
>>> AT&T Digital Life
>>> DLC Software Development
>>> 404-499-7013
>>> (cell) 678-365-6508
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Remko Popma <re...@yahoo.com>.
After looking at your changes for LOG4J2-318 to add the shutdownHookEnabled attribute I understand a bit better.

Here is a list of properties that can be used to configure AsyncLoggers when all loggers are Async:
* Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
* AsyncLogger.ExceptionHandler
* AsyncLogger.RingBufferSize
* AsyncLogger.WaitStrategy
* log4j.Clock - currently only used for timestamping RingBufferLogEvents. Should all LogEvents 

The following system properties can be used to configure mixed Async Loggers:
* AsyncLoggerConfig.ExceptionHandler
* AsyncLoggerConfig.RingBufferSize
* AsyncLoggerConfig.WaitStrategy

For JMX there is only the one "disable" property, which Gary suggested to make into an element rather than an attribute to future-proof it.

So, should the result look something like this?

<configuration level="warn" Log4jContextSelector="org.apache.logging.log4j.core.async.AsyncLoggerContextSelector">
  <async-configuration exceptionHandler="my.custom.Handler" ringBufferSize="128" waitStrategy="Block" />
  <jmx enabled="true" />
</configuration>


From: Ralph Goers <ra...@dslextreme.com>
To: Log4J Developers List <lo...@logging.apache.org> 
Sent: Wednesday, July 24, 2013 2:38 AM
Subject: Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??
 

What don't you know?  I'd be happy to help with that :-)

Ralph


On Jul 23, 2013, at 9:20 AM, Remko Popma wrote:

> I wouldn't mind doing this but don't know how. 
> 
> Remko
> 
> Sent from my iPhone
> 
> On 2013/07/24, at 0:46, Nick Williams <ni...@nicholaswilliams.net> wrote:
> 
>> I don't know the answer to this guy's question on the user's list, but it brought up something interesting that we need to look at. Already (in a separate issue) we have talked about needing a config element for JMX so that you don't have to use properties in this manner. IMO, if there's not a way to set these AsyncLogger configuration options in log4j2.xml/json, that needs to be added, too. You should never have to do System.setProperty (or -D on the command line) to get Log4j configured properly.
>> 
>> My $0.02.
>> 
>> Nick
>> 
>> On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
>> 
>>> http://logging.apache.org/log4j/2.x/manual/async.html
>>> 
>>> This URL describes that v2 has both async logger and async appender.   What is the suggested config for an embedded situation where I want low latency, nothing fancy?
>>> 
>>> I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.
>>> 
>>> System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
>>> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
>>> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
>>> System.setProperty("log4j2.disable.jmx", "true");               // saves on a jmx jar and we don't use JMX anyway
>>> 
>>> Tnx curt
>>> 
>>> Curt Smith
>>> AT&T Digital Life
>>> DLC Software Development
>>> 404-499-7013
>>> (cell) 678-365-6508
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Ralph Goers <ra...@dslextreme.com>.
What don't you know?  I'd be happy to help with that :-)

Ralph


On Jul 23, 2013, at 9:20 AM, Remko Popma wrote:

> I wouldn't mind doing this but don't know how. 
> 
> Remko
> 
> Sent from my iPhone
> 
> On 2013/07/24, at 0:46, Nick Williams <ni...@nicholaswilliams.net> wrote:
> 
>> I don't know the answer to this guy's question on the user's list, but it brought up something interesting that we need to look at. Already (in a separate issue) we have talked about needing a config element for JMX so that you don't have to use properties in this manner. IMO, if there's not a way to set these AsyncLogger configuration options in log4j2.xml/json, that needs to be added, too. You should never have to do System.setProperty (or -D on the command line) to get Log4j configured properly.
>> 
>> My $0.02.
>> 
>> Nick
>> 
>> On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
>> 
>>> http://logging.apache.org/log4j/2.x/manual/async.html
>>> 
>>> This URL describes that v2 has both async logger and async appender.   What is the suggested config for an embedded situation where I want low latency, nothing fancy?
>>> 
>>> I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.
>>> 
>>> System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
>>> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
>>> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
>>> System.setProperty("log4j2.disable.jmx", "true");               // saves on a jmx jar and we don't use JMX anyway
>>> 
>>> Tnx curt
>>> 
>>> Curt Smith
>>> AT&T Digital Life
>>> DLC Software Development
>>> 404-499-7013
>>> (cell) 678-365-6508
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Remko Popma <re...@yahoo.com>.
I wouldn't mind doing this but don't know how. 

Remko

Sent from my iPhone

On 2013/07/24, at 0:46, Nick Williams <ni...@nicholaswilliams.net> wrote:

> I don't know the answer to this guy's question on the user's list, but it brought up something interesting that we need to look at. Already (in a separate issue) we have talked about needing a config element for JMX so that you don't have to use properties in this manner. IMO, if there's not a way to set these AsyncLogger configuration options in log4j2.xml/json, that needs to be added, too. You should never have to do System.setProperty (or -D on the command line) to get Log4j configured properly.
> 
> My $0.02.
> 
> Nick
> 
> On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
> 
>> http://logging.apache.org/log4j/2.x/manual/async.html
>> 
>> This URL describes that v2 has both async logger and async appender.   What is the suggested config for an embedded situation where I want low latency, nothing fancy?
>> 
>> I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.
>> 
>> System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
>> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
>> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
>> System.setProperty("log4j2.disable.jmx", "true");               // saves on a jmx jar and we don't use JMX anyway
>> 
>> Tnx curt
>> 
>> Curt Smith
>> AT&T Digital Life
>> DLC Software Development
>> 404-499-7013
>> (cell) 678-365-6508
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Paul Benedict <pb...@apache.org>.
That's true. Furthermore, he's lucky that he can set properties without
throwing an exception. Some IT environments have that locked down so
applications can't mangle them.


On Tue, Jul 23, 2013 at 10:49 AM, Gary Gregory <ga...@gmail.com>wrote:

> On Jul 23, 2013, at 11:47, Nick Williams <ni...@nicholaswilliams.net>
> wrote:
>
> > I don't know the answer to this guy's question on the user's list, but
> it brought up something interesting that we need to look at. Already (in a
> separate issue) we have talked about needing a config element for JMX so
> that you don't have to use properties in this manner. IMO, if there's not a
> way to set these AsyncLogger configuration options in log4j2.xml/json, that
> needs to be added, too. You should never have to do System.setProperty (or
> -D on the command line) to get Log4j configured properly.
>
> +1
>
> Gary
>
> >
> > My $0.02.
> >
> > Nick
> >
> > On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
> >
> >> http://logging.apache.org/log4j/2.x/manual/async.html
> >>
> >> This URL describes that v2 has both async logger and async appender.
> What is the suggested config for an embedded situation where I want low
> latency, nothing fancy?
> >>
> >> I've had do this in code since we don't own the cmd line:  OSGi and
> system vendor owns the box and java command line.
> >>
> >> System.setProperty("AsyncLoggerContextSelector",
> "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
> >> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min
> size permissable to keep memory low
> >> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less
> CPU, better for embedded env
> >> System.setProperty("log4j2.disable.jmx", "true");               //
> saves on a jmx jar and we don't use JMX anyway
> >>
> >> Tnx curt
> >>
> >> Curt Smith
> >> AT&T Digital Life
> >> DLC Software Development
> >> 404-499-7013
> >> (cell) 678-365-6508
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-dev-help@logging.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>


-- 
Cheers,
Paul

Re: Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Gary Gregory <ga...@gmail.com>.
On Jul 23, 2013, at 11:47, Nick Williams <ni...@nicholaswilliams.net> wrote:

> I don't know the answer to this guy's question on the user's list, but it brought up something interesting that we need to look at. Already (in a separate issue) we have talked about needing a config element for JMX so that you don't have to use properties in this manner. IMO, if there's not a way to set these AsyncLogger configuration options in log4j2.xml/json, that needs to be added, too. You should never have to do System.setProperty (or -D on the command line) to get Log4j configured properly.

+1

Gary

>
> My $0.02.
>
> Nick
>
> On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:
>
>> http://logging.apache.org/log4j/2.x/manual/async.html
>>
>> This URL describes that v2 has both async logger and async appender.   What is the suggested config for an embedded situation where I want low latency, nothing fancy?
>>
>> I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.
>>
>> System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
>> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
>> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
>> System.setProperty("log4j2.disable.jmx", "true");               // saves on a jmx jar and we don't use JMX anyway
>>
>> Tnx curt
>>
>> Curt Smith
>> AT&T Digital Life
>> DLC Software Development
>> 404-499-7013
>> (cell) 678-365-6508
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Config additions, WAS: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Nick Williams <ni...@nicholaswilliams.net>.
I don't know the answer to this guy's question on the user's list, but it brought up something interesting that we need to look at. Already (in a separate issue) we have talked about needing a config element for JMX so that you don't have to use properties in this manner. IMO, if there's not a way to set these AsyncLogger configuration options in log4j2.xml/json, that needs to be added, too. You should never have to do System.setProperty (or -D on the command line) to get Log4j configured properly.

My $0.02.

Nick

On Jul 23, 2013, at 10:39 AM, SMITH, CURTIS wrote:

> http://logging.apache.org/log4j/2.x/manual/async.html
> 
> This URL describes that v2 has both async logger and async appender.   What is the suggested config for an embedded situation where I want low latency, nothing fancy?
> 
> I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.
> 
> System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
> System.setProperty("log4j2.disable.jmx", "true");               // saves on a jmx jar and we don't use JMX anyway
> 
> Tnx curt
> 
> Curt Smith
> AT&T Digital Life
> DLC Software Development
> 404-499-7013
> (cell) 678-365-6508
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: Confused: want low latency: do I need BOTH async logger AND async appender??

Posted by Remko Popma <re...@yahoo.com>.
Curt,

Without knowing your app & env characteristics, I'd say that looks fine. The ring buffer won't grow, so if you get bursts larger than 128 log events you will see latency going up as logging will become IO bound when the ring buffer is full. 

Otherwise all seems reasonable. 
Let me know if you hit any snags.

Regards,
Remko

Sent from my iPhone

On 2013/07/24, at 0:39, "SMITH, CURTIS" <cs...@att.com> wrote:

> http://logging.apache.org/log4j/2.x/manual/async.html
> 
> This URL describes that v2 has both async logger and async appender.   What is the suggested config for an embedded situation where I want low latency, nothing fancy?
> 
> I've had do this in code since we don't own the cmd line:  OSGi and system vendor owns the box and java command line.
> 
> System.setProperty("AsyncLoggerContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
> System.setProperty("AsyncLogger.RingBufferSize", "128");        // min size permissable to keep memory low
> System.setProperty("AsyncLogger.WaitStrategy", "Block");        // less CPU, better for embedded env
> System.setProperty("log4j2.disable.jmx", "true");               // saves on a jmx jar and we don't use JMX anyway
> 
> Tnx curt
> 
> Curt Smith
> AT&T Digital Life
> DLC Software Development
> 404-499-7013
> (cell) 678-365-6508
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org