Re: log4j 2 official release date

2013-10-01 Thread Roland
Very interesting...
All tests were performed with a dual core. But what results can we expect if
single core is used?

Thanks!



--
View this message in context: 
http://apache-logging.6191.n7.nabble.com/log4j-2-official-release-date-tp40916p40979.html
Sent from the Log4j - Users mailing list archive at Nabble.com.

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



Re: default value for missing key in mdc

2013-10-01 Thread Oliver Flege
 $${mdc:request_id} in a pattern should cause the request_id to be evaluated 
 on every event.
 

thanks a lot, $${ctx:request_id} seems to do the trick

however, the computation of the default value is quite complex as it always 
involves
a variable substitution, and I cannot use conversion specifiers with $$ as I 
can with %X

Would you consider accepting a patch that adds support for slf4j-like default 
values
in %X{key} and %K{key}, s.th. like %X{key:-defaultValue} ?

Regards,
Oliver



 
 On Sep 30, 2013, at 8:04 AM, Oliver Flege ofl...@vwd.com wrote:

 ok, this works for ${...} expressions in the configuration, but I don't see 
 how it would
 apply to pattern evaluation. To simplify and rephrase my original question:

 Given a pattern layout with a pattern like:  %X{REQUEST_ID}

 is it possible to define a default value that will be printed
 if the thread never executed ThreadContext.put(REQUEST_ID, XYZ)?

 I tried ${mdc:REQUEST_ID} + a Property REQUEST_ID, but that
 will only be evaluated when the configuration is parsed.

 Oliver

 Yes, it supports default values. Specify them as properties at the 
 beginning of your configuration. Then when you specify something like 
 ${sys:foo} if foo is not defined as a system property the default value 
 will be used,

 Ralph

 On Sep 30, 2013, at 3:30 AM, Oliver Flege ofl...@vwd.com wrote:

 Hi,

 I am considering to switch from slf4j/logback to log4j2;

 in slf4j/logback, I can specify a default value for a missing mdc entry
 like this:

 pattern%d{HH:mm:ss} %X{FOO:--} %c{0} - %m%n/pattern

 which would print - if mdc.get(FOO) is null (the :- separates
 the key and the default value).

 Having a defined number of tokens/fields at the beginning of the log 
 message
 makes it easier to process it with awk/cut etc.


 Does log4j support default values? - I could not find any hint in the 
 documentation



 Regards,
 Oliver

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

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


 -- 
 Oliver Flege
 Senior Software Engineer | vwd group

 vwd Vereinigte Wirtschaftsdienste AG
 Stiftsplatz 6/7 | 67655 Kaiserslautern
 Telefon: +49 631 3649-0 | Telefax: +49 631 3649-109
 ofl...@vwd.com | www.vwd.com
 __

 vwd Vereinigte Wirtschaftsdienste AG
 Sitz der Gesellschaft: Tilsiter Straße 1 | 60487 Frankfurt am Main
 Handelsregister: AG Frankfurt am Main HRB 81011
 Vorstand: Dr. Ralf Kauther
 Vorsitzender des Aufsichtsrates: Dr. Thorsten Dippel
 

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

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


-- 
Oliver Flege
Senior Software Engineer | vwd group

vwd Vereinigte Wirtschaftsdienste AG
Stiftsplatz 6/7 | 67655 Kaiserslautern
Telefon: +49 631 3649-0 | Telefax: +49 631 3649-109
ofl...@vwd.com | www.vwd.com
__

vwd Vereinigte Wirtschaftsdienste AG
Sitz der Gesellschaft: Tilsiter Straße 1 | 60487 Frankfurt am Main
Handelsregister: AG Frankfurt am Main HRB 81011
Vorstand: Dr. Ralf Kauther
Vorsitzender des Aufsichtsrates: Dr. Thorsten Dippel


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



Re: log4j 2 official release date

2013-10-01 Thread Ralph Goers
How common is a single core any more? I suppose it might be common I embedded 
systems.

Ralph

 On Sep 30, 2013, at 11:55 PM, Roland w...@ids.de wrote:
 
 Very interesting...
 All tests were performed with a dual core. But what results can we expect if
 single core is used?
 
 Thanks!
 
 
 
 --
 View this message in context: 
 http://apache-logging.6191.n7.nabble.com/log4j-2-official-release-date-tp40916p40979.html
 Sent from the Log4j - Users mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 

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



Re: default value for missing key in mdc

2013-10-01 Thread Ralph Goers
Patches are always welcome!

Ralph

On Oct 1, 2013, at 1:13 AM, Oliver Flege ofl...@vwd.com wrote:

 $${mdc:request_id} in a pattern should cause the request_id to be evaluated 
 on every event.
 
 thanks a lot, $${ctx:request_id} seems to do the trick
 
 however, the computation of the default value is quite complex as it always 
 involves
 a variable substitution, and I cannot use conversion specifiers with $$ as I 
 can with %X
 
 Would you consider accepting a patch that adds support for slf4j-like default 
 values
 in %X{key} and %K{key}, s.th. like %X{key:-defaultValue} ?
 
 Regards,
 Oliver
 
 
 
 
 On Sep 30, 2013, at 8:04 AM, Oliver Flege ofl...@vwd.com wrote:
 
 ok, this works for ${...} expressions in the configuration, but I don't see 
 how it would
 apply to pattern evaluation. To simplify and rephrase my original question:
 
 Given a pattern layout with a pattern like:  %X{REQUEST_ID}
 
 is it possible to define a default value that will be printed
 if the thread never executed ThreadContext.put(REQUEST_ID, XYZ)?
 
 I tried ${mdc:REQUEST_ID} + a Property REQUEST_ID, but that
 will only be evaluated when the configuration is parsed.
 
 Oliver
 
 Yes, it supports default values. Specify them as properties at the 
 beginning of your configuration. Then when you specify something like 
 ${sys:foo} if foo is not defined as a system property the default value 
 will be used,
 
 Ralph
 
 On Sep 30, 2013, at 3:30 AM, Oliver Flege ofl...@vwd.com wrote:
 
 Hi,
 
 I am considering to switch from slf4j/logback to log4j2;
 
 in slf4j/logback, I can specify a default value for a missing mdc entry
 like this:
 
 pattern%d{HH:mm:ss} %X{FOO:--} %c{0} - %m%n/pattern
 
 which would print - if mdc.get(FOO) is null (the :- separates
 the key and the default value).
 
 Having a defined number of tokens/fields at the beginning of the log 
 message
 makes it easier to process it with awk/cut etc.
 
 
 Does log4j support default values? - I could not find any hint in the 
 documentation
 
 
 
 Regards,
 Oliver
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 
 -- 
 Oliver Flege
 Senior Software Engineer | vwd group
 
 vwd Vereinigte Wirtschaftsdienste AG
 Stiftsplatz 6/7 | 67655 Kaiserslautern
 Telefon: +49 631 3649-0 | Telefax: +49 631 3649-109
 ofl...@vwd.com | www.vwd.com
 __
 
 vwd Vereinigte Wirtschaftsdienste AG
 Sitz der Gesellschaft: Tilsiter Straße 1 | 60487 Frankfurt am Main
 Handelsregister: AG Frankfurt am Main HRB 81011
 Vorstand: Dr. Ralf Kauther
 Vorsitzender des Aufsichtsrates: Dr. Thorsten Dippel
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 
 -- 
 Oliver Flege
 Senior Software Engineer | vwd group
 
 vwd Vereinigte Wirtschaftsdienste AG
 Stiftsplatz 6/7 | 67655 Kaiserslautern
 Telefon: +49 631 3649-0 | Telefax: +49 631 3649-109
 ofl...@vwd.com | www.vwd.com
 __
 
 vwd Vereinigte Wirtschaftsdienste AG
 Sitz der Gesellschaft: Tilsiter Straße 1 | 60487 Frankfurt am Main
 Handelsregister: AG Frankfurt am Main HRB 81011
 Vorstand: Dr. Ralf Kauther
 Vorsitzender des Aufsichtsrates: Dr. Thorsten Dippel
 
 
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org
 

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



Re: log4j 2 official release date

2013-10-01 Thread Remko Popma
Michael,

I finally got around to looking at the test results you posted on Github (
https://github.com/michaelzhou999/logging-profiling).

Very extensive testing, I can tell you put a lot of work into it!

I was initially a bit surprised by your Log4J2 finding that at ten threads
or more, synchronous logging with RandomAccessFile is even faster than
async logging with RandomAccessFile. But I believe this is because the
performance test logs 500,000 events, and the async logger ring buffer by
default only has 256*1024 slots. When the ring buffer is full the test can
only put new log events into the ring buffer when previous events have been
taken out, so essentially it will be running at the speed of the
RandomAccessFile appender with the additional overhead of going through the
ring buffer.

To be honest I am not sure why this effect does not occur with 1 - 5
threads.

Also interesting to see a similar phenomenon with LogBack:
async appender is faster with 1 - 5 threads, but from 10 threads and up,
synchronous logging is faster than asynchrous logging.

In this case, the LogBack default queue size is only 256, and it is a
fixed-size queue, so it is basically full all the way through the test. So
I think what we're seeing here is the throughput of the underlying appender
plus the contention of the multiple threads trying to add to the queue.
Again unsure about the difference between 10+ threads and 1 - 5 threads...
(I noticed you correctly set the discardingThreshold to zero for LogBack
so it won't start dropping trace/debug/info events when the queue is 80%
full.  Well-spotted! Don't allow LogBack to cheat! :-) )

But to make the test fair the LogBack queue size should really be the same
as the Log4J2 async logger queue size (256*1024).

Actually, I would recommend making the queues large enough to contain all
events. If you want to log 500,000 in the test, the queues should be at
least that size. Otherwise the async test will actually be measuring a
partially async and partially synchronous logging.

One final note: are you aware that Log4J2 natively supports SLF4J-style
formatting? e.g. logger.info(hi {}, world!);

Overall, I was happy to see that your results are similar to the results I
reported in the performance section of the Async Loggers page.

Best regards,
Remko




On Sun, Sep 29, 2013 at 9:59 PM, Michael Zhou michael.z...@gmail.comwrote:

 Hi Remko,

 You can find the micro-benchmarking tool I wrote on Github:
 https://github.com/michaelzhou999/logging-profiling

 Drop me a message if you have any questions.  Thanks

 Michael


 On Sat, Sep 28, 2013 at 9:34 PM, Remko Popma remko.po...@gmail.com
 wrote:

  Michael,
 
  I'd be interested to see your benchmarking code and results. Is it
  possible for you to share them?
 
  Remko
 
  Sent from my iPhone
 
   On 2013/09/29, at 7:58, Michael Zhou michael.z...@gmail.com wrote:
  
   The micro-benchmark testing I wrote to compare Log4j 1 and 2 shows
   considerable performance gain in favor of Log4j 2.  I have only one
  request
   for your consideration: simplifying the way to get all loggers in the
   system and set/reset logging levels for certain loggers.  This is very
  easy
   to do in Log4j 1, but thanks to the rewrite of API and implementation
 in
   Log4j 2, it becomes complicated.  I did search and read previous
   discussions (in August and May) on this topic, and consider this a much
   needed feature request.  Thanks
  
  
   On Sat, Sep 28, 2013 at 2:44 AM, Ralph Goers 
 ralph.go...@dslextreme.com
  wrote:
  
   I'd prefer to turn this around and ask a couple of questions:
  
   1. Why do you need to know the official release date?  Is something
   blocking you from using Log4j 2?
   2. Are you currently using the beta releases?  Are you satisfied that
 it
   is production ready in your environment?
  
   The answers to the questions above are important for us as that is the
   basis for us labeling the release 2.0 GA vs 2.0 beta10 (or 2.0 RC1).
  
   Ralph
  
   On Sep 27, 2013, at 8:07 AM, Jingdong Sun wrote:
  
   Can anyone tell me when the log4j 2 official release will be
 available?
  
   Thanks.
   Jingdong Sun
   InfoSphere Streams Development
   Phone  507 253-5958  (T/L 553-5958)
   jind...@us.ibm.com
  
  
   -
   To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
   For additional commands, e-mail: log4j-user-h...@logging.apache.org
  
  
   --
   Michael
 
  -
  To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
  For additional commands, e-mail: log4j-user-h...@logging.apache.org
 
 


 --
 Michael



Re: log4j 2 official release date

2013-10-01 Thread Michael Zhou
Thanks Remko for the valuable insight on queue size and ring buffer size in
log4j and logback.  I will make adjustments to the settings and run the
test again.


On Tue, Oct 1, 2013 at 10:02 AM, Remko Popma remko.po...@gmail.com wrote:

 Michael,

 I finally got around to looking at the test results you posted on Github (
 https://github.com/michaelzhou999/logging-profiling).

 Very extensive testing, I can tell you put a lot of work into it!

 I was initially a bit surprised by your Log4J2 finding that at ten threads
 or more, synchronous logging with RandomAccessFile is even faster than
 async logging with RandomAccessFile. But I believe this is because the
 performance test logs 500,000 events, and the async logger ring buffer by
 default only has 256*1024 slots. When the ring buffer is full the test can
 only put new log events into the ring buffer when previous events have been
 taken out, so essentially it will be running at the speed of the
 RandomAccessFile appender with the additional overhead of going through the
 ring buffer.

 To be honest I am not sure why this effect does not occur with 1 - 5
 threads.

 Also interesting to see a similar phenomenon with LogBack:
 async appender is faster with 1 - 5 threads, but from 10 threads and up,
 synchronous logging is faster than asynchrous logging.

 In this case, the LogBack default queue size is only 256, and it is a
 fixed-size queue, so it is basically full all the way through the test. So
 I think what we're seeing here is the throughput of the underlying appender
 plus the contention of the multiple threads trying to add to the queue.
 Again unsure about the difference between 10+ threads and 1 - 5 threads...
 (I noticed you correctly set the discardingThreshold to zero for LogBack
 so it won't start dropping trace/debug/info events when the queue is 80%
 full.  Well-spotted! Don't allow LogBack to cheat! :-) )

 But to make the test fair the LogBack queue size should really be the same
 as the Log4J2 async logger queue size (256*1024).

 Actually, I would recommend making the queues large enough to contain all
 events. If you want to log 500,000 in the test, the queues should be at
 least that size. Otherwise the async test will actually be measuring a
 partially async and partially synchronous logging.

 One final note: are you aware that Log4J2 natively supports SLF4J-style
 formatting? e.g. logger.info(hi {}, world!);

 Overall, I was happy to see that your results are similar to the results I
 reported in the performance section of the Async Loggers page.

 Best regards,
 Remko




 On Sun, Sep 29, 2013 at 9:59 PM, Michael Zhou michael.z...@gmail.com
 wrote:

  Hi Remko,
 
  You can find the micro-benchmarking tool I wrote on Github:
  https://github.com/michaelzhou999/logging-profiling
 
  Drop me a message if you have any questions.  Thanks
 
  Michael
 
 
  On Sat, Sep 28, 2013 at 9:34 PM, Remko Popma remko.po...@gmail.com
  wrote:
 
   Michael,
  
   I'd be interested to see your benchmarking code and results. Is it
   possible for you to share them?
  
   Remko
  
   Sent from my iPhone
  
On 2013/09/29, at 7:58, Michael Zhou michael.z...@gmail.com wrote:
   
The micro-benchmark testing I wrote to compare Log4j 1 and 2 shows
considerable performance gain in favor of Log4j 2.  I have only one
   request
for your consideration: simplifying the way to get all loggers in the
system and set/reset logging levels for certain loggers.  This is
 very
   easy
to do in Log4j 1, but thanks to the rewrite of API and implementation
  in
Log4j 2, it becomes complicated.  I did search and read previous
discussions (in August and May) on this topic, and consider this a
 much
needed feature request.  Thanks
   
   
On Sat, Sep 28, 2013 at 2:44 AM, Ralph Goers 
  ralph.go...@dslextreme.com
   wrote:
   
I'd prefer to turn this around and ask a couple of questions:
   
1. Why do you need to know the official release date?  Is
 something
blocking you from using Log4j 2?
2. Are you currently using the beta releases?  Are you satisfied
 that
  it
is production ready in your environment?
   
The answers to the questions above are important for us as that is
 the
basis for us labeling the release 2.0 GA vs 2.0 beta10 (or 2.0 RC1).
   
Ralph
   
On Sep 27, 2013, at 8:07 AM, Jingdong Sun wrote:
   
Can anyone tell me when the log4j 2 official release will be
  available?
   
Thanks.
Jingdong Sun
InfoSphere Streams Development
Phone  507 253-5958  (T/L 553-5958)
jind...@us.ibm.com
   
   
   
 -
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org
   
   
--
Michael
  
   -
   To unsubscribe, e-mail: 

Re: OutOfMenoryError in log4j-2.0-beta9

2013-10-01 Thread Yiru Li
I have created a JIRA ticket for this issue.
Please let me know if you need more detail. I can also do more test as you
instruct.

thanks a lot
Yiru


On Mon, Sep 30, 2013 at 10:52 PM, Remko Popma remko.po...@gmail.com wrote:

 Thank you for reporting this.
 Can I ask you to create a JIRA ticket for this issue? Can you add a few
 details: what OS, java version, startup options (especially memory
 related), and please attach your log4j2.xml config file.

 Ideally also describe how I can reproduce the issue.

 What do you mean by ran a larger file though our system?

 Best regards,
 Remko

 On Tuesday, October 1, 2013, Yiru Li wrote:

  I have configured to use all loggers asynchronous. When I ran a small
 file
  over our system, there was no problem.
 
  When  ran a larger file though our system, the problem was raised as
  described below:
 
  Sep 30, 2013 2:56:08 PM com.lmax.disruptor.FatalExceptionHandler
  handleEventExce  ption
  SEVERE: Exception processing: 14451294
  org.apache.logging.log4j.core.async.RingB  ufferLogEvent@226dc6bf
  java.lang.OutOfMemoryError: Java heap space
 
  Exception in thread AsyncLogger-1 java.lang.RuntimeException:
  java.lang.OutOfM  emoryError: Java heap space
  at
  com.lmax.disruptor.FatalExceptionHandler.handleEventException(FatalEx
   ceptionHandler.java:45)
  at
  com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:1
  52)
  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
   java:1145)
  at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
   .java:615)
  at java.lang.Thread.run(Thread.java:722)
  Caused by: java.lang.OutOfMemoryError: Java heap space
  Exception in thread pool-2-thread-3 java.lang.OutOfMemoryError: Java
 heap
  spac  e
  Exception in thread Thread-3 java.lang.OutOfMemoryError: Java heap
 space
  Exception in thread Thread-2 java.lang.OutOfMemoryError: Java heap
 space
  Exception in thread pool-2-thread-1 java.lang.NullPointerException
  at
  org.apache.logging.log4j.core.async.AsyncLogger.log(AsyncLogger.java:
  223)
  at
  org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLogger
   Wrapper.java:55)
  at org.slf4j.impl.SLF4JLogger.warn(SLF4JLogger.java:317)
  at com.envisagesystems.util.logger.LogTag.pattern(LogTag.java:91)
  at
  com.envisagesystems.util.logger.LogTag.getLogMessage(LogTag.java:200)
  at
  com.envisagesystems.cloud.workflow.eventsystem.EventConsumer.logExcep
   tion(EventConsumer.java:235)
  at
  com.envisagesystems.cloud.workflow.eventsystem.WorkFlowEventHandler.l
   ogException(WorkFlowEventHandler.java:515)
  at
  com.envisagesystems.cloud.workflow.eventsystemmq.polling.JobQueueRead
   er.run(JobQueueReader.java:136)
  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
   java:1145)
  at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
   .java:615)
  at java.lang.Thread.run(Thread.java:722)
  Exception in thread pool-2-thread-2 java.lang.NullPointerException
  at
  org.apache.logging.log4j.core.async.AsyncLogger.log(AsyncLogger.java:
  223)
  at
  org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLogger
   Wrapper.java:55)
  at org.slf4j.impl.SLF4JLogger.warn(SLF4JLogger.java:317)
  at com.envisagesystems.util.logger.LogTag.pattern(LogTag.java:91)
  at
  com.envisagesystems.util.logger.LogTag.getLogMessage(LogTag.java:200)
  at
  com.envisagesystems.cloud.workflow.eventsystem.EventConsumer.logExcep
   tion(EventConsumer.java:235)
  at
  com.envisagesystems.cloud.workflow.eventsystem.WorkFlowEventHandler.l
   ogException(WorkFlowEventHandler.java:515)
  at
  com.envisagesystems.cloud.workflow.eventsystemmq.polling.JobQueueRead
   er.run(JobQueueReader.java:136)
  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
   java:1145)
  at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
   .java:615)
  at java.lang.Thread.run(Thread.java:722)
  Exception in thread pool-4-thread-3 java.lang.NullPointerException
  at
  org.apache.logging.log4j.core.async.AsyncLogger.log(AsyncLogger.java:
  223)
  at
  org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLogger
   Wrapper.java:55)
  at org.slf4j.impl.SLF4JLogger.debug(SLF4JLogger.java:138)
  at
  com.envisagesystems.cloud.workflow.eventsystemmq.polling.JobQueueRead
   er$_Runnable.run(JobQueueReader.java:378)
  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
   java:1145)
  at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
   .java:615)
  at java.lang.Thread.run(Thread.java:722)
 



Multiple appenders and verbose logging for specific classes for an appender

2013-10-01 Thread fedinho
Hi.

A simple question I hope someone can help me with. This is using log4j 1.2.x

I would like to log info level to one appender A and warn level to another
appenderB.

However, I would like to log debug messages from class X to appender A, and
debug messages from class Y to appender B.

Thanks for any tips for a configuration that will work. Threshold is not
the way to go. Is there a way A and B can have different root loggers or
categories?

Kind regards
Fredrik


Re: Multiple appenders and verbose logging for specific classes for an appender

2013-10-01 Thread Jacob Kjome

On Tue, 1 Oct 2013 18:17:41 +0200
 fedinho fedi...@gmail.com wrote:

Hi.

A simple question I hope someone can help me with. This is using log4j 1.2.x

I would like to log info level to one appender A and warn level to another
appenderB.

However, I would like to log debug messages from class X to appender A, and
debug messages from class Y to appender B.

Thanks for any tips for a configuration that will work. Threshold is not
the way to go. Is there a way A and B can have different root loggers or
categories?



This is usually done by setting the logger additivity to false for either 
the logger in question or one it inherits from, which essentially makes the 
logger with additivity=false the root logger for all inheritors.  See...


http://logging.apache.org/log4j/1.2/manual.html#Appenders_and_Layouts



Kind regards
Fredrik



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



Re: epoch time format for logging

2013-10-01 Thread Gary Gregory
I create a JIRA to track possible solutions:
https://issues.apache.org/jira/browse/LOG4J2-415

I have attached two different solutions in a patch file.

Gary


On Mon, Sep 30, 2013 at 11:33 PM, Gary Gregory garydgreg...@gmail.comwrote:

 Hello Ed,

 This is what Log4j 2 can do now WRT to time stamp formatting:
 https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout

 When you say epoch time, do you mean simply that you would like to use the
 result of java.lang.System.currentTimeMillis() ?

 Gary


 On Mon, Sep 30, 2013 at 8:30 PM, Edward Peschko horo...@gmail.com wrote:

 All,

 For reasons of simplicity  consistency, I would like to have my logs
 have epoch time (plus milliseconds) as their format. I figure:

 1. this should be the most efficient way to get a timestamp
 2. it is completely clear - unlike local time, or partial times (eg.
 HH:MM:SS) there is no question of exactly when the event occurred.
 3. it is concise - only taking 10 (or 14 with ms timestamp) characters.
 4. it is exceedingly easy to do date arithmetic with it
 5. it can searched as a number hence finding ranges in which events
 occured in very large files is a simple, binary search.

 Anyways, looking through the docs for log4j, I didn't see any docs on
 how to do this. Is it possible, and if not currently possible, how
 easy would it be to add it?

 Again, I'd like to standardize all my logs on this, so any info on how
 to do it is appreciated..

 Thanks much,

 Ed

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




 --
 E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
 Java Persistence with Hibernate, Second 
 Editionhttp://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




-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Editionhttp://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