log4j2 Async Loggers

2014-06-10 Thread Ulavapalli, Prashant
Hi,

I am trying to configure async loggers for my application using log4j2. When I 
log my events .. They still seem to be synchronous. I see the log even flushed 
to the file immediately. I would have assumed, async loggers will hold the 
events till the buffer is full before flushing. How do I confirm if is actually 
doing asynchronous logging. Or please correct if I am missing something.

In my startup I have (for all async loggers).

-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
Also, have the disruptor 3.2.1 in the class path. I use slf4j and use the 
bridge to log to log4j2
This is my log4j2.xml (just using the one which the 
http://logging.apache.org/log4j/2.x/manual/appenders.html provides)


  1.  ?xml version=1.0 encoding=UTF-8?
  2.  Configuration status=warn name=MyApp packages=
  3.  Appenders
  4.  RollingRandomAccessFile name=RollingRandomAccessFile 
fileName=logs/app.log
  5.  filePattern=logs/$${date:-MM}/app-%d{MM-dd-}-%i.log.gz 
immediateFlush=false
  6.  PatternLayout
  7.  Pattern%d %p %c{1.} [%t] %m%n/Pattern
  8.  /PatternLayout
  9.  Policies
  10. TimeBasedTriggeringPolicy /
  11. SizeBasedTriggeringPolicy size=250 MB/
  12. /Policies
  13. /RollingRandomAccessFile
  14. /Appenders
  15. Loggers
  16. Root level=error
  17. AppenderRef ref=RollingRandomAccessFile/
  18. /Root
  19. /Loggers
  20. /Configuration

Thanks
-prashant


Re: log4j2 Async Loggers

2014-06-10 Thread Ulavapalli, Prashant
Or is it something to do with this..


http://www.grobmeier.de/log4j-2-performance-close-to-insane-20072013.html#.U5c7MpRdUUU


One nice little detail I should mention is that both Async Loggers and Async 
Appenders fix something that has always bothered me in Log4j-1.x, which is that 
they will flush the buffer after logging the last event in the queue. With 
Log4j-1.x, if you used buffered I/O, you often could not see the last few log 
events, as they were still stuck in the memory buffer. Your only option was 
setting immediateFlush to true, which forces disk I/O on every single log event 
and has a performance impact. With Async Loggers and Appenders in Log4j-2.0 
your log statements are all flushed to disk, so they are always visible, but 
this happens in a very efficient manner.

Can somebody confirm.

Thanks
-prashant


From: Ulavapalli, Prashant Ulavapalli 
prashant.ulavapa...@digitalinsight.commailto:prashant.ulavapa...@digitalinsight.com
Reply-To: Log4J Users List 
log4j-user@logging.apache.orgmailto:log4j-user@logging.apache.org
Date: Tuesday, June 10, 2014 at 10:05 AM
To: log4j-user@logging.apache.orgmailto:log4j-user@logging.apache.org 
log4j-user@logging.apache.orgmailto:log4j-user@logging.apache.org
Subject: log4j2 Async Loggers

Hi,

I am trying to configure async loggers for my application using log4j2. When I 
log my events .. They still seem to be synchronous. I see the log even flushed 
to the file immediately. I would have assumed, async loggers will hold the 
events till the buffer is full before flushing. How do I confirm if is actually 
doing asynchronous logging. Or please correct if I am missing something.

In my startup I have (for all async loggers).

-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
Also, have the disruptor 3.2.1 in the class path. I use slf4j and use the 
bridge to log to log4j2
This is my log4j2.xml (just using the one which the 
http://logging.apache.org/log4j/2.x/manual/appenders.html provides)


  1.  ?xml version=1.0 encoding=UTF-8?
  2.  Configuration status=warn name=MyApp packages=
  3.  Appenders
  4.  RollingRandomAccessFile name=RollingRandomAccessFile 
fileName=logs/app.log
  5.  filePattern=logs/$${date:-MM}/app-%d{MM-dd-}-%i.log.gz 
immediateFlush=false
  6.  PatternLayout
  7.  Pattern%d %p %c{1.} [%t] %m%n/Pattern
  8.  /PatternLayout
  9.  Policies
  10. TimeBasedTriggeringPolicy /
  11. SizeBasedTriggeringPolicy size=250 MB/
  12. /Policies
  13. /RollingRandomAccessFile
  14. /Appenders
  15. Loggers
  16. Root level=error
  17. AppenderRef ref=RollingRandomAccessFile/
  18. /Root
  19. /Loggers
  20. /Configuration

Thanks
-prashant



Log4j2 with JBOSS 5

2014-06-06 Thread Ulavapalli, Prashant
I was trying to upgrade to log4j2 myself for JBOSS 5. And seem to running into 
issues. Somehow JBOSS 5 is not recognizing the changes I made.

By default I guess JBOSS uses there jbosslogging and somehow I am not able to 
tie in log4j2 to it.

I have added

log4j-1.2-api-2.0-rc1.jar
log4j-api-2.0-rc1.jar
log4j-core-2.0-rc1.jar

In the war, I am deploying.

Also have replace/removed log4j 1.2 with the above jars in

jboss_home/client/
jboss_home/common/lib


Is there anything else I am missing?

Any help is much appreciated.

Thanks
-prash


Re: Log4j2 with JBOSS 5

2014-06-06 Thread Ulavapalli, Prashant
I see this exception


Caused by: java.lang.SecurityException: class 
org.slf4j.helpers.Log4jLoggerFactory's signer information does not match 
signer information of other classes in the same package

at java.lang.ClassLoader.checkCerts(ClassLoader.java:812)

at java.lang.ClassLoader.preDefineClass(ClassLoader.java:493)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)

at java.lang.ClassLoader.defineClass(ClassLoader.java:621)

at 
org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:67)

at 
org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:633)

at 
org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:592)

at java.security.AccessController.doPrivileged(Native Method)

at 
org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:591)

at 
org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:568)

at 
org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:135)

at 
org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)

at 
org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:455)

at 
org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:267)

at 
org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:166)


Here is my setup

JBOSS-5, JDK 6

Added a file - JBOSS_HOME/server/default/conf/log4j2.xml
In the JBOSS_HOME/server/default/conf/jboss-server.xml
Update the mbean to load log4j2.xml
mbean code=org.jboss.logging.Log4jService 
name=jboss.system:type=Log4jService,service=Logging 
xmbean-dd=resource:xmdesc/Log4jService-xmbean.xml
  attribute name=ConfigurationURLresource:log4j2.xml/attribute


I have the following libraries in

JBOSS_HOME/client and JBOSS_HOME/common/lib
log4j-1.2-api-2.0-rc1
log4j-api-2.0-rc1
log4j-core-2.0-rc1
log4j-slf4j-impl-2.0-rc1


Any ideas?
Thanks
-prash

From: Ralph Goers 
ralph.go...@dslextreme.commailto:ralph.go...@dslextreme.com
Reply-To: Log4J Users List 
log4j-user@logging.apache.orgmailto:log4j-user@logging.apache.org
Date: Friday, June 6, 2014 at 11:20 AM
To: Log4J Users List 
log4j-user@logging.apache.orgmailto:log4j-user@logging.apache.org
Subject: Re: Log4j2 with JBOSS 5

I seem to recall having to remove a jbosslogging jar as it had its own SLF4J 
binding in it. Plus there was a bug that they didn't define one of the JUL log 
levels and it would throw an exception.  But I haven't looked at Jboss 
integration in about a year so the exact details are sketchy.

Ralph

On Jun 6, 2014, at 10:43 AM, Ulavapalli, Prashant 
prashant.ulavapa...@digitalinsight.commailto:prashant.ulavapa...@digitalinsight.com
 wrote:

I was trying to upgrade to log4j2 myself for JBOSS 5. And seem to running into 
issues. Somehow JBOSS 5 is not recognizing the changes I made.
By default I guess JBOSS uses there jbosslogging and somehow I am not able to 
tie in log4j2 to it.
I have added
log4j-1.2-api-2.0-rc1.jar
log4j-api-2.0-rc1.jar
log4j-core-2.0-rc1.jar
In the war, I am deploying.
Also have replace/removed log4j 1.2 with the above jars in
jboss_home/client/
jboss_home/common/lib
Is there anything else I am missing?
Any help is much appreciated.
Thanks
-prash


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