Re: Catalina.out trace : memory leak

2014-04-10 Thread Mahesh Dilhan
HI

Answers are in blue

This may be caused by the LoggerContext.stop() method not being called.

Which version of Tomcat are you using?  Special care is needed for Tomcat
7.0.40 and older.
*apache-tomcat-7.0.47*

A similar issue, LOG4J2-578 seemed to be caused by a config issue where the
version number in web.xml was incorrect.
Can you check this?

*web-app xmlns=http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
http://www.w3.org/2001/XMLSchema-instance
 xsi:schemaLocation=http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee*
*http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd   version=3.0
 metadata-complete=true*

*WEB-INF/lib does not contains any servlet-api, [tomcat container provides
the servlet-api.jar] *
Also, are the log4j jars under the shared Catalina lib? No
I suspect the problem goes away if you put the log4j jars under your
webapp's WEB-INF/lib folder.

*Dependencies are located in WEB-INF/lib ,*
*dependency*
*groupIdcom.lmax/groupId*
*artifactIddisruptor/artifactId*
*version3.2.1/version*
*/dependency *
*dependency*
*groupIdorg.apache.logging.log4j/groupId*
*artifactIdlog4j-api/artifactId*
*version2.0-rc1/version*
*/dependency*
*dependency*
*groupIdorg.apache.logging.log4j/groupId*
*artifactIdlog4j-core/artifactId*
*version2.0-rc1/version*
*/dependency*
*dependency*
*groupIdorg.apache.logging.log4j/groupId*
*artifactIdlog4j-slf4j-impl/artifactId*
*version2.0-rc1/version*
*/dependency*
*dependency*
*groupIdorg.apache.logging.log4j/groupId*
*artifactIdlog4j-1.2-api/artifactId*
*version2.0-rc1/version*
*/dependency*


*For test 1 Configurations are  in -catalina.properties   for test 2 that
is in -catalina.sh [CATALINA_OPTS] , in both occation, it worked*
*Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector*
*log4j2.disable.jmx=true*

But I still get following console out


2014-04-10 12:56:09,120 DEBUG Shutting down OutputStreamManager SYSTEM_OUT
2014-04-10 12:56:09,123 DEBUG JMX disabled for log4j2. Not registering
MBeans.
2014-04-10 12:56:09,168 DEBUG Using default SystemClock for timestamps
2014-04-10 12:56:09,169 DEBUG AsyncLogger.ThreadNameStrategy=CACHED
2014-04-10 12:56:09,171 DEBUG property AsyncLogger.WaitStrategy=null
2014-04-10 12:56:09,173 DEBUG disruptor event handler uses
SleepingWaitStrategy
2014-04-10 12:56:09,197 DEBUG No AsyncLogger.ExceptionHandler specified
2014-04-10 12:56:09,203 DEBUG Starting AsyncLogger disruptor with
ringbuffer size 262144...

SEVERE: The web application [/app] created a ThreadLocal with key of type
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@17b3a1e]) and a value
of type [org.apache.logging.log4j.core.async.AsyncLogger.Info] (value
[org.apache.logging.log4j.core.async.AsyncLogger$Info@1aca2de]) but failed
to remove it when the web application was stopped. Threads are going to be
renewed over time to try and avoid a probable memory leak.
Apr 10, 2014 2:53:28 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks



*Also JConsole*

*Name: AsyncLogger-1*
*State: TIMED_WAITING*
*Total blocked: 1  Total waited: 228,630 [ this number getting increased ]*

*Stack trace: *
*sun.misc.Unsafe.park(Native Method)*
*java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:317)*
*com.lmax.disruptor.SleepingWaitStrategy.applyWaitMethod(SleepingWaitStrategy.java:78)*
*com.lmax.disruptor.SleepingWaitStrategy.waitFor(SleepingWaitStrategy.java:51)*
*com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:55)*
*com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:123)*
*java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)*
*java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)*
*java.lang.Thread.run(Thread.java:619)*


On Thu, Apr 10, 2014 at 9:51 AM, Remko Popma remko.po...@gmail.com wrote:

 This may be caused by the LoggerContext.stop() method not being called.

 Which version of Tomcat are you using? Special care is needed for Tomcat
 7.0.40 and older.

 A similar issue, LOG4J2-578 seemed to be caused by a config issue where
 the version number in web.xml was incorrect. Can you check this?

 Also, are the log4j jars under the shared Catalina lib? I suspect the
 problem goes away if you put the log4j jars under your webapp's WEB-INF/lib
 folder.

 Remko

 Sent from my iPhone

  On 2014/04/10, at 11:24, Mahesh Dilhan mail.mahesh...@gmail.com wrote:
 
  HI
 
  I got following catalina console out continuously  when I try to stop the
  web application.
 
  Brief  on configuration
  *version : rc1*
 
  *Log4j2.xml

Re: Catalina.out trace : memory leak

2014-04-10 Thread Mahesh Dilhan
, 2014 at 6:58 PM, Mahesh Dilhan mail.mahesh...@gmail.com
 wrote:

  HI
 
  Answers are in blue
 
  This may be caused by the LoggerContext.stop() method not being called.
 
  Which version of Tomcat are you using?  Special care is needed for Tomcat
  7.0.40 and older.
  *apache-tomcat-7.0.47*
 
  A similar issue, LOG4J2-578 seemed to be caused by a config issue where
 the
  version number in web.xml was incorrect.
  Can you check this?
 
  *web-app xmlns=http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
  http://www.w3.org/2001/XMLSchema-instance
   xsi:schemaLocation=http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee*
  *http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd   version=3.0
   metadata-complete=true*
 
  *WEB-INF/lib does not contains any servlet-api, [tomcat container
 provides
  the servlet-api.jar] *
  Also, are the log4j jars under the shared Catalina lib? No
  I suspect the problem goes away if you put the log4j jars under your
  webapp's WEB-INF/lib folder.
 
  *Dependencies are located in WEB-INF/lib ,*
  *dependency*
  *groupIdcom.lmax/groupId*
  *artifactIddisruptor/artifactId*
  *version3.2.1/version*
  */dependency *
  *dependency*
  *groupIdorg.apache.logging.log4j/groupId*
  *artifactIdlog4j-api/artifactId*
  *version2.0-rc1/version*
  */dependency*
  *dependency*
  *groupIdorg.apache.logging.log4j/groupId*
  *artifactIdlog4j-core/artifactId*
  *version2.0-rc1/version*
  */dependency*
  *dependency*
  *groupIdorg.apache.logging.log4j/groupId*
  *artifactIdlog4j-slf4j-impl/artifactId*
  *version2.0-rc1/version*
  */dependency*
  *dependency*
  *groupIdorg.apache.logging.log4j/groupId*
  *artifactIdlog4j-1.2-api/artifactId*
  *version2.0-rc1/version*
  */dependency*
 
 
  *For test 1 Configurations are  in -catalina.properties   for test 2
 that
  is in -catalina.sh [CATALINA_OPTS] , in both occation, it worked*
 
 
 *Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector*
  *log4j2.disable.jmx=true*
 
  But I still get following console out
 
 
  2014-04-10 12:56:09,120 DEBUG Shutting down OutputStreamManager
 SYSTEM_OUT
  2014-04-10 12:56:09,123 DEBUG JMX disabled for log4j2. Not registering
  MBeans.
  2014-04-10 12:56:09,168 DEBUG Using default SystemClock for timestamps
  2014-04-10 12:56:09,169 DEBUG AsyncLogger.ThreadNameStrategy=CACHED
  2014-04-10 12:56:09,171 DEBUG property AsyncLogger.WaitStrategy=null
  2014-04-10 12:56:09,173 DEBUG disruptor event handler uses
  SleepingWaitStrategy
  2014-04-10 12:56:09,197 DEBUG No AsyncLogger.ExceptionHandler specified
  2014-04-10 12:56:09,203 DEBUG Starting AsyncLogger disruptor with
  ringbuffer size 262144...
 
  SEVERE: The web application [/app] created a ThreadLocal with key of type
  [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@17b3a1e]) and a
  value
  of type [org.apache.logging.log4j.core.async.AsyncLogger.Info] (value
  [org.apache.logging.log4j.core.async.AsyncLogger$Info@1aca2de]) but
 failed
  to remove it when the web application was stopped. Threads are going to
 be
  renewed over time to try and avoid a probable memory leak.
  Apr 10, 2014 2:53:28 PM org.apache.catalina.loader.WebappClassLoader
  checkThreadLocalMapForLeaks
 
 
 
  *Also JConsole*
 
  *Name: AsyncLogger-1*
  *State: TIMED_WAITING*
  *Total blocked: 1  Total waited: 228,630 [ this number getting increased
 ]*
 
  *Stack trace: *
  *sun.misc.Unsafe.park(Native Method)*
  *java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:317)*
 
 
 *com.lmax.disruptor.SleepingWaitStrategy.applyWaitMethod(SleepingWaitStrategy.java:78)*
 
 
 *com.lmax.disruptor.SleepingWaitStrategy.waitFor(SleepingWaitStrategy.java:51)*
 
 
 *com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:55)*
 
 *com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:123)*
 
 
 *java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)*
 
 
 *java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)*
  *java.lang.Thread.run(Thread.java:619)*
 
 
  On Thu, Apr 10, 2014 at 9:51 AM, Remko Popma remko.po...@gmail.com
  wrote:
 
   This may be caused by the LoggerContext.stop() method not being called.
  
   Which version of Tomcat are you using? Special care is needed for
 Tomcat
   7.0.40 and older.
  
   A similar issue, LOG4J2-578 seemed to be caused by a config issue where
   the version number in web.xml was incorrect. Can you check this?
  
   Also, are the log4j jars under the shared Catalina lib? I suspect the
   problem goes away if you put the log4j jars

Re: Catalina.out trace : memory leak

2014-04-10 Thread Mahesh Dilhan
side note ; java version : JDK 1.6.0_10

Remko

Can you share a dummy maven webapp [.tar] some where in
http://logging.apache.org/log4j/2.x/manual/async.html
 , with necessary dependencies  and [*Async]* configuration for log4j2.xml
So ppl can just build and deploy it in a tomcat container [  7.0.40 ], and
provide feedback, as this might be a problem in my configuration

steps of test case : deploy/ start/stop, trace catalina.out

Thanks in advance


On Fri, Apr 11, 2014 at 7:49 AM, Mahesh Dilhan mail.mahesh...@gmail.comwrote:

 Observed followings after

  - removing
  
 Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
 from catalina.properties
 - change Root .. /Root tag to
 AsyncRoot level=INFO includeLocation=false
 AppenderRef ref=RollingFile-${web:contextPath}/
 /AsyncRoot


 On start-up

 014-04-11 07:43:03,640 ERROR An exception occurred processing Appender
 RollingFile-/app java.lang.NullPointerException
at java.lang.StringBuilder.init(StringBuilder.java:92)
at
 org.apache.logging.log4j.core.pattern.NameAbbreviator$PatternAbbreviator.abbreviate(NameAbbreviator.java:286)
at
 org.apache.logging.log4j.core.pattern.NamePatternConverter.abbreviate(NamePatternConverter.java:53)
at
 org.apache.logging.log4j.core.pattern.LoggerPatternConverter.format(LoggerPatternConverter.java:64)
at
 org.apache.logging.log4j.core.pattern.PatternFormatter.format(PatternFormatter.java:36)
at
 org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:172)
at
 org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:52)
at
 org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:45)
at
 org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:118)
at
 org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender.append(RollingRandomAccessFileAppender.java:96)
at
 org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
at
 org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:425)
at
 org.apache.logging.log4j.core.async.AsyncLoggerConfig.asyncCallAppenders(AsyncLoggerConfig.java:117)
at
 org.apache.logging.log4j.core.async.AsyncLoggerConfigHelper$Log4jEventWrapperHandler.onEvent(AsyncLoggerConfigHelper.java:222)
at
 org.apache.logging.log4j.core.async.AsyncLoggerConfigHelper$Log4jEventWrapperHandler.onEvent(AsyncLoggerConfigHelper.java:207)
at
 com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:128)
at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)


 Also Console
 Apr 11, 2014 7:42:49 AM org.apache.catalina.loader.WebappClassLoader
 checkThreadLocalMapForLeaks
 SEVERE: The web application [/clearing-newcdev10] created a ThreadLocal
 with key of type [java.lang.ThreadLocal] (value
 [java.lang.ThreadLocal@131d70a]) and a value of type [
 org.apache.logging.log4j.core.async.AsyncLogger.Info] (value
 [org.apache.logging.log4j.core.async.AsyncLogger$Info@11cd743]) but
 failed to remove it when the web application was stopped. Threads are going
 to be renewed over time to try and avoid a probable memory leak.



 *Now JConsole has two thread *

 *Name: AsyncLoggerConfig-1*
 State: TIMED_WAITING
 Total blocked: 0  Total waited: 307,234

 Stack trace:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:317)

 com.lmax.disruptor.SleepingWaitStrategy.applyWaitMethod(SleepingWaitStrategy.java:78)

 com.lmax.disruptor.SleepingWaitStrategy.waitFor(SleepingWaitStrategy.java:51)

 com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:55)
 com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:123)

 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 java.lang.Thread.run(Thread.java:619)


 *Name: AsyncLogger-1*
 State: TIMED_WAITING
 Total blocked: 0  Total waited: 325,479

 Stack trace:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:317)

 com.lmax.disruptor.SleepingWaitStrategy.applyWaitMethod(SleepingWaitStrategy.java:78)

 com.lmax.disruptor.SleepingWaitStrategy.waitFor(SleepingWaitStrategy.java:51)

 com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:55)
 com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:123)

 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886

Catalina.out trace : memory leak

2014-04-09 Thread Mahesh Dilhan
HI

I got following catalina console out continuously  when I try to stop the
 web application.

Brief  on configuration
*version : rc1*

*Log4j2.xml*

Configuration status=OFF 
  Appenders
RollingRandomAccessFile name=RollingFile-${web:contextPath}
fileName=${sys:catalina.home}/logs/current/${web:contextPath}.log
immediateFlush=false append=false

 
filePattern=${sys:catalina.home}/logs/archived/%d{-MM-dd}${contextName}-%d{-MM-dd}.log.gz
  PatternLayout
Pattern%d %p %c{1.} [%t] %m%n/Pattern
  /PatternLayout
  Policies
TimeBasedTriggeringPolicy /
  /Policies
/RollingRandomAccessFile
  /Appenders
  Loggers
Root level=INFO includeLocation=false
  AppenderRef ref=RollingFile-${web:contextPath}/

/Root
  /Loggers
/Configuration

*Tomcat properties :*
 Asysnc logger [tomcat is configured with the property
{Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
 }





Apr 08, 2014 12:32:17 PM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/app] appears to have started a thread named
[AsyncLogger-1] but has failed to stop it. *This is very likely to create a
memory leak.*
Apr 08, 2014 12:32:17 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/app] created a ThreadLocal with key of type
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@e8d7057]) and a value
of type [org.apache.logging.log4j.core.async.AsyncLogger.Info] (value
[org.apache.logging.log4j.core.async.AsyncLogger$Info@67ca6737]) but failed
to remove it when the web application was stopped. Threads are going to be
renewed over time to try and avoid a probable memory leak.



What could be missing in my configuration to run into a such console trace ?
What are the fixes I should look-into ?


Thanks


Re: beta9 to rc1

2014-03-22 Thread Mahesh Dilhan
)
at java.util.HashMap.writeObject(HashMap.java:1001)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at
org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1673)
at
org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1079)
at
org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:432)
at
org.apache.catalina.session.StandardManager.unload(StandardManager.java:353)
at
org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:518)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at
org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5622)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at
org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575)
at
org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564)
... 5 more
Mar 21, 2014 6:54:39 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory
E:\DEV\Apache\apache-tomcat-7.0.47\webapps\docs
Mar 21, 2014 6:54:40 PM org.apache.tomcat.jdbc.pool.ConnectionPool init


Thanks


On Thu, Mar 20, 2014 at 7:37 AM, Mahesh Dilhan mail.mahesh...@gmail.comwrote:

 HI

 I'm using AsyncLogger and it satisfied the what i need.
 1 : Asysnc logger [tomcat is configured with the property
 {Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
  }

 2. I'm using  rolling random access appender

 3. *Lookups *works as expected



 Following is a part of log4j2.xml.



 Properties
 Property name=contextName$${web:contextPath}/Property
  Property name=catalinaHome$${sys:catalina.home}/Property
 Property
 name=filename${catalinaHome}/logs/current/${contextName}.log/Property
   /Properties
   Appenders

 RollingRandomAccessFile name=RollingFile-${web:contextPath}
 fileName=${filename} immediateFlush=false append=false

  
 filePattern=${catalinaHome}/logs/archived/%d{-MM-dd}${contextName}-%d{-MM-dd}.log.gz
   PatternLayout
 Pattern%d %p %c{1.} [%t] %m%n/Pattern
   /PatternLayout
   Policies
 TimeBasedTriggeringPolicy /
   /Policies
 /RollingRandomAccessFile




 Everything was perfect before I change the version from *beta9 *to *rc1*

 1. Exception occurred while initializing tomcat, *but this is not a show
 stopper*.
 2. File is created with a name AsyncLoggerContext.log.
 3. *Lookup suddenly stop working , which is a show stopper for me*



 So I had to rollback the version again.

 are there any new configuration which comes with *rc1?*


 SEVERE: IOException while loading persisted sessions:
 java.io.WriteAbortedException: writing aborted;
 java.io.NotSerializableException: org.ap
 ache.logging.log4j.core.Logger$PrivateConfig
 java.io.WriteAbortedException: writing aborted;
 java.io.NotSerializableException:
 org.apache.logging.log4j.core.Logger$PrivateConfig
 at
 java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
 at
 java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
 at
 java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
 at
 java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
 at
 java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
 at
 java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
 at
 java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
 at
 java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
 at
 java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
 at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
 at java.util.HashMap.readObject(HashMap.java:1030)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke

beta9 to rc1

2014-03-19 Thread Mahesh Dilhan
$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)








-- 
Mahesh Dilhan


Re: log4j2 and log4j1.x conflicts with Kafka

2013-11-25 Thread Mahesh Dilhan
I had the same issue.
Sort out by following dependencies

dependency
groupIdorg.apache.logging.log4j/groupId
artifactIdlog4j-slf4j-impl/artifactId
version2.0-beta9/version
/dependency
dependency
groupIdorg.apache.logging.log4j/groupId
artifactIdlog4j-1.2-api/artifactId
version2.0-beta9/version
/dependency


On Tue, Nov 26, 2013 at 3:40 AM, Remko Popma remko.po...@gmail.com wrote:

 David,

 Log4j2 comes with an adapter for log4j1.2. (See the FAQ page.)
 The adapter will route kafka's calls to the log4j1.x api to the log4j2
 implementation.

 As Gary mentioned, avoid having the old log4j1.x implementation jar in the
 classpath.

 Regards,
 Remko

 Sent from my iPhone

  On 2013/11/26, at 3:22, David KOCH dk...@ezakus.com wrote:
 
  Hello,
 
  I wrote a custom log4j2 appender for Kafka https://kafka.apache.org/
 and
  it seems to be working fine. The only issue I have is that that Kafka
  itself uses log4j 1.x for internal logging so when I use my
  --Dlog4j.configurationFile=my-log4j.xml Kafka generates warnings/errors
  like:
 
  log4j:WARN No appenders could be found for logger
  (kafka.utils.VerifiableProperties).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
  more info.
  SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder.
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for
 further
  details.
 
  How can avoid this?
 
  I guess it's because expects a log4j 1.x compatible setup. This is a
  maven project and I include dependencies via the pom.xml. Note that I
 need
  both log4j1.x (for Kafka) and log4j2.x - for logging to my custom Kafka
  appender and other appenders that I use.
 
  Thanks,
 
  /David
 
  Dependencies in my pom.xml:
 
  dependencies
  dependency
  groupIdorg.apache.logging.log4j/groupId
  artifactIdlog4j-api/artifactId
  version2.0-beta9/version
  /dependency
  dependency
  groupIdorg.apache.logging.log4j/groupId
  artifactIdlog4j-core/artifactId
  version2.0-beta9/version
  /dependency
  dependency
  groupIdcommons-cli/groupId
  artifactIdcommons-cli/artifactId
  version1.2/version
  /dependency
  dependency
  groupIdorg.apache.kafka/groupId
  artifactIdkafka_2.9.2/artifactId
  version0.8.0-beta1/version
  /dependency
  dependency
  groupIdcom.yammer.metrics/groupId
  artifactIdmetrics-core/artifactId
  version2.2.0/version
  /dependency
  dependency
  groupIdcom.yammer.metrics/groupId
  artifactIdmetrics-annotation/artifactId
  version2.2.0/version
  /dependency
  dependency
  groupIdlog4j/groupId
  artifactIdlog4j/artifactId
  version1.2.17/version
  /dependency
  dependency
  groupIdorg.scala-lang/groupId
  artifactIdscala-library/artifactId
  version2.9.2/version
  /dependency
  /dependencies

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




-- 
Mahesh Dilhan


Re: Log4j2 - JConsole JMX appender

2013-10-31 Thread Mahesh Dilhan
Hi Scott,

Thanks  a lot ,


On Thu, Oct 31, 2013 at 10:25 AM, Scott Deboy scott.de...@gmail.com wrote:

 Actually there is already a WebLookup, which supports 'contextPath',
 'servletContextName', etc.  See:
 http://logging.apache.org/log4j/2.x/manual/lookups.html

 On 10/30/13, Scott Deboy scott.de...@gmail.com wrote:
  What might be easiest is to use separate log4j configurations for each
  web app, specifying unique names in each web app's log4j configuration
  file.  See http://logging.apache.org/log4j/2.x/manual/logsep.html for
  more information.
 
  http://logging.apache.org/log4j/2.x/manual/webapp.html mentions that
  the ServletContext's context name is used as the LoggerContext name,
  but the LoggerContext name isn't exposed anywhere that I can see as
  something you could use in the naming of your rolling file.
 
  You may be able to do this by implementing your own Lookup - see
  http://logging.apache.org/log4j/2.x/manual/extending.html
 
  Hope that helps.
 
  Scott
 
  On 10/30/13, Mahesh Dilhan mail.mahesh...@gmail.com wrote:
  Hi Scott
 
  thanks for the reply.
 
  Actually I wanted to know that how to get the
  *web-application-context-path
  dynamically, without hard-code in the log4j2.xml.*
  *
  *
  *Sorry for the inconvenience, if i did not make my self clear .*
  *
  *
   is there a way to output log file name as :
  *web-application-context-path
  *-date.log ? [configuration of log4j2,xml]
 
  Yes I did append the *date* by looking at RollingAppender.
 
  Thanks
 
 
 
  On Thu, Oct 31, 2013 at 6:48 AM, Scott Deboy scott.de...@gmail.com
  wrote:
 
  I'm not clear myself on when an async logger is useful - I am more
  familiar with the (previously existing) concept of async appenders.
 
  I think the documentation in this area needs to be enhanced to explain
  why you would use async loggers or async appenders, particularly for
  file IO.
 
  As for generating log files with dates, yes, you can specify your own
  date-related pattern with a RollingFileAppender.  See the
  documentation on RollingFileAppender and examples here:
  http://logging.apache.org/log4j/2.x/manual/appenders.html
 
  Scott
 
  On 10/30/13, Mahesh Dilhan mail.mahesh...@gmail.com wrote:
   Hi Scott
  
   I already configured it , yes it works for fileAppeders.
   I have seen the perftest of async logger. will there be performance
   hit
   with fileAppender compared to async logger? I already noticed time
   taken
   for initialization process is varying for file and random access
 file.
   is
   it because of distruptor?
  
   is there a way to output log file name as :
   *web-application-context-path*-date.log
   ? [configuration of log4j2,xml]
  
   Thanks
  
  
  
  
   On Thu, Oct 31, 2013 at 3:16 AM, Scott Deboy scott.de...@gmail.com
  wrote:
  
   Mi Mahesh,
  
   If you'd like to use Chainsaw with log4j2, you need to use the
 latest
   Chainsaw developer snapshot, available here:
   http://people.apache.org/~sdeboy
  
   If you use a file appender in your log4j configuration, add the
 JmDns
   jar to your application classpath (http://jmdns.sourceforge.net),
 and
   update your log4j configuration as described in the documentation
   (including specifying a URI to your log file), Chainsaw should be
   able
   to parse and tail your log file.
  
   Feel free to ask additional questions here on the user list.
  
   Scott
  
   On 10/28/13, Mahesh Dilhan mail.mahesh...@gmail.com wrote:
Thanks for the clarification Remko
   
   
On Tue, Oct 29, 2013 at 8:52 AM, Remko Popma
remko.po...@gmail.com
   wrote:
   
Hi Mahesh,
   
Thank you for re-posting your question to the user mailing list.
   
The Status Logger is a special logger used by log4j internally.
If you set it to debug or trace (by starting your config xml
file
with Configuration
status=debug...),
it will output things like which appenders and loggers were
initialized,
which log4j plugins were found, etc.
Any configuration problems will show up in the status log.
The status log output will appear on the console (System.out).
   
In JConsole, this internal logging is what you see in the
  StatusLogger
tab.
   
I'm guessing from your question that you would like to see the
 log
statements produced by your application in the JConsole viewer.
Unfortunately, JMX currently does not provide a way to show the
content
of
application log files.
   
If you are looking for a tool that allows you to view the log
 file
from
   a
remote machine you may want to take a look at Chainsaw.
http://logging.apache.org/chainsaw/
   
Scott Deboy has been doing work to make Chainsaw's zeroconf
feature
work
well with log4j2.
I am not that familiar with Chainsaw, but perhaps this
documentation
can
get you started:
   
   
  
 
 http://logging.apache.org/log4j/2.x/manual/configuration.html#AdvertisingAppenderConfigurations
   
Best

Re: Log4j2 - JConsole JMX appender

2013-10-30 Thread Mahesh Dilhan
Hi Scott

I already configured it , yes it works for fileAppeders.
I have seen the perftest of async logger. will there be performance hit
with fileAppender compared to async logger? I already noticed time taken
for initialization process is varying for file and random access file. is
it because of distruptor?

is there a way to output log file name as :
*web-application-context-path*-date.log
? [configuration of log4j2,xml]

Thanks




On Thu, Oct 31, 2013 at 3:16 AM, Scott Deboy scott.de...@gmail.com wrote:

 Mi Mahesh,

 If you'd like to use Chainsaw with log4j2, you need to use the latest
 Chainsaw developer snapshot, available here:
 http://people.apache.org/~sdeboy

 If you use a file appender in your log4j configuration, add the JmDns
 jar to your application classpath (http://jmdns.sourceforge.net), and
 update your log4j configuration as described in the documentation
 (including specifying a URI to your log file), Chainsaw should be able
 to parse and tail your log file.

 Feel free to ask additional questions here on the user list.

 Scott

 On 10/28/13, Mahesh Dilhan mail.mahesh...@gmail.com wrote:
  Thanks for the clarification Remko
 
 
  On Tue, Oct 29, 2013 at 8:52 AM, Remko Popma remko.po...@gmail.com
 wrote:
 
  Hi Mahesh,
 
  Thank you for re-posting your question to the user mailing list.
 
  The Status Logger is a special logger used by log4j internally.
  If you set it to debug or trace (by starting your config xml file
  with Configuration
  status=debug...),
  it will output things like which appenders and loggers were initialized,
  which log4j plugins were found, etc.
  Any configuration problems will show up in the status log.
  The status log output will appear on the console (System.out).
 
  In JConsole, this internal logging is what you see in the StatusLogger
  tab.
 
  I'm guessing from your question that you would like to see the log
  statements produced by your application in the JConsole viewer.
  Unfortunately, JMX currently does not provide a way to show the content
  of
  application log files.
 
  If you are looking for a tool that allows you to view the log file from
 a
  remote machine you may want to take a look at Chainsaw.
  http://logging.apache.org/chainsaw/
 
  Scott Deboy has been doing work to make Chainsaw's zeroconf feature work
  well with log4j2.
  I am not that familiar with Chainsaw, but perhaps this documentation can
  get you started:
 
 
 http://logging.apache.org/log4j/2.x/manual/configuration.html#AdvertisingAppenderConfigurations
 
  Best regards,
  Remko
 
 
 
  On Tue, Oct 29, 2013 at 9:58 AM, Mahesh Dilhan 
 mail.mahesh...@gmail.com
  wrote:
 
   Hi All,
  
   i'm interested in learning on JMX monitoring in log4j2.
  
   As explained I was able to get the log4j2 'tab'  statusLogger child
   tab
  in
   JConsole with the initial logging statements.
  
   Note:version : 2.0.9beta
  
   log4j2.xml
  
   ?xml version=1.0 encoding=UTF-8?
  
   !-- No need to set system property Log4jContextSelector to any
 value
when using asyncLogger or asyncRoot. --
  
   Configuration status=debug
 Appenders
   !-- Async Loggers will auto-flush in batches, so switch off
   immediateFlush. --
   RandomAccessFile name=RandomAccessFile
   fileName=asyncWithLocation.log
 immediateFlush=false append=false
 PatternLayout
   Pattern%d %p %class{1.} [%t] %location %m %ex%n/Pattern
 /PatternLayout
   /RandomAccessFile
  
 /Appenders
 Loggers 
   !-- pattern layout actually uses location, so we need to include
   it
   --
   AsyncLogger  name=notificationLogger level=trace
   includeLocation=true
 AppenderRef ref=RandomAccessFile/
   /AsyncLogger
   Root level=debug includeLocation=true
 AppenderRef ref=notificationLogger/
   /Root
 /Loggers
   /Configuration
  
   !-- notificationLogger --
   private static Logger logger =
  LogManager.getLogger(notificationLogger);
  
  
   When web Application(java/servlet/spring) runs I can see the
   file[asyncWithLocation.log] get appended with the logging statements,
   I like to see Jconsole get appended too, But It did not.
  
  
   I wonder, what configuration I should use to enable jmx logging, so
   that
  I
   can see them in JConsole?
  
   is there any documentation other than this
   http://logging.apache.org/log4j/2.x/manual/jmx.html,
  
   it would be great if above documentation is updated with a sample of
   log4j2.xml configuration.
  
   Thanks
  
   Mahesh
  
 
 
 
 
  Mahesh
 

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




-- 
Mahesh


Re: Log4j2 - JConsole JMX appender

2013-10-30 Thread Mahesh Dilhan
Hi Scott

thanks for the reply.

Actually I wanted to know that how to get the *web-application-context-path
dynamically, without hard-code in the log4j2.xml.*
*
*
*Sorry for the inconvenience, if i did not make my self clear .*
*
*
 is there a way to output log file name as : *web-application-context-path
*-date.log ? [configuration of log4j2,xml]

Yes I did append the *date* by looking at RollingAppender.

Thanks



On Thu, Oct 31, 2013 at 6:48 AM, Scott Deboy scott.de...@gmail.com wrote:

 I'm not clear myself on when an async logger is useful - I am more
 familiar with the (previously existing) concept of async appenders.

 I think the documentation in this area needs to be enhanced to explain
 why you would use async loggers or async appenders, particularly for
 file IO.

 As for generating log files with dates, yes, you can specify your own
 date-related pattern with a RollingFileAppender.  See the
 documentation on RollingFileAppender and examples here:
 http://logging.apache.org/log4j/2.x/manual/appenders.html

 Scott

 On 10/30/13, Mahesh Dilhan mail.mahesh...@gmail.com wrote:
  Hi Scott
 
  I already configured it , yes it works for fileAppeders.
  I have seen the perftest of async logger. will there be performance hit
  with fileAppender compared to async logger? I already noticed time taken
  for initialization process is varying for file and random access file. is
  it because of distruptor?
 
  is there a way to output log file name as :
  *web-application-context-path*-date.log
  ? [configuration of log4j2,xml]
 
  Thanks
 
 
 
 
  On Thu, Oct 31, 2013 at 3:16 AM, Scott Deboy scott.de...@gmail.com
 wrote:
 
  Mi Mahesh,
 
  If you'd like to use Chainsaw with log4j2, you need to use the latest
  Chainsaw developer snapshot, available here:
  http://people.apache.org/~sdeboy
 
  If you use a file appender in your log4j configuration, add the JmDns
  jar to your application classpath (http://jmdns.sourceforge.net), and
  update your log4j configuration as described in the documentation
  (including specifying a URI to your log file), Chainsaw should be able
  to parse and tail your log file.
 
  Feel free to ask additional questions here on the user list.
 
  Scott
 
  On 10/28/13, Mahesh Dilhan mail.mahesh...@gmail.com wrote:
   Thanks for the clarification Remko
  
  
   On Tue, Oct 29, 2013 at 8:52 AM, Remko Popma remko.po...@gmail.com
  wrote:
  
   Hi Mahesh,
  
   Thank you for re-posting your question to the user mailing list.
  
   The Status Logger is a special logger used by log4j internally.
   If you set it to debug or trace (by starting your config xml file
   with Configuration
   status=debug...),
   it will output things like which appenders and loggers were
   initialized,
   which log4j plugins were found, etc.
   Any configuration problems will show up in the status log.
   The status log output will appear on the console (System.out).
  
   In JConsole, this internal logging is what you see in the
 StatusLogger
   tab.
  
   I'm guessing from your question that you would like to see the log
   statements produced by your application in the JConsole viewer.
   Unfortunately, JMX currently does not provide a way to show the
   content
   of
   application log files.
  
   If you are looking for a tool that allows you to view the log file
   from
  a
   remote machine you may want to take a look at Chainsaw.
   http://logging.apache.org/chainsaw/
  
   Scott Deboy has been doing work to make Chainsaw's zeroconf feature
   work
   well with log4j2.
   I am not that familiar with Chainsaw, but perhaps this documentation
   can
   get you started:
  
  
 
 http://logging.apache.org/log4j/2.x/manual/configuration.html#AdvertisingAppenderConfigurations
  
   Best regards,
   Remko
  
  
  
   On Tue, Oct 29, 2013 at 9:58 AM, Mahesh Dilhan 
  mail.mahesh...@gmail.com
   wrote:
  
Hi All,
   
i'm interested in learning on JMX monitoring in log4j2.
   
As explained I was able to get the log4j2 'tab'  statusLogger
 child
tab
   in
JConsole with the initial logging statements.
   
Note:version : 2.0.9beta
   
log4j2.xml
   
?xml version=1.0 encoding=UTF-8?
   
!-- No need to set system property Log4jContextSelector to any
  value
 when using asyncLogger or asyncRoot. --
   
Configuration status=debug
  Appenders
!-- Async Loggers will auto-flush in batches, so switch off
immediateFlush. --
RandomAccessFile name=RandomAccessFile
fileName=asyncWithLocation.log
  immediateFlush=false append=false
  PatternLayout
Pattern%d %p %class{1.} [%t] %location %m %ex%n/Pattern
  /PatternLayout
/RandomAccessFile
   
  /Appenders
  Loggers 
!-- pattern layout actually uses location, so we need to
include
it
--
AsyncLogger  name=notificationLogger level=trace
includeLocation=true
  AppenderRef ref=RandomAccessFile

Log4j2 - JConsole JMX appender

2013-10-28 Thread Mahesh Dilhan
Hi All,

i'm interested in learning on JMX monitoring in log4j2.

As explained I was able to get the log4j2 'tab'  statusLogger child tab in
JConsole with the initial logging statements.

Note:version : 2.0.9beta

log4j2.xml

?xml version=1.0 encoding=UTF-8?

!-- No need to set system property Log4jContextSelector to any value
 when using asyncLogger or asyncRoot. --

Configuration status=debug
  Appenders
!-- Async Loggers will auto-flush in batches, so switch off
immediateFlush. --
RandomAccessFile name=RandomAccessFile
fileName=asyncWithLocation.log
  immediateFlush=false append=false
  PatternLayout
Pattern%d %p %class{1.} [%t] %location %m %ex%n/Pattern
  /PatternLayout
/RandomAccessFile

  /Appenders
  Loggers 
!-- pattern layout actually uses location, so we need to include it --
AsyncLogger  name=notificationLogger level=trace
includeLocation=true
  AppenderRef ref=RandomAccessFile/
/AsyncLogger
Root level=debug includeLocation=true
  AppenderRef ref=notificationLogger/
/Root
  /Loggers
/Configuration

!-- notificationLogger --
private static Logger logger = LogManager.getLogger(notificationLogger);


When web Application(java/servlet/spring) runs I can see the
file[asyncWithLocation.log] get appended with the logging statements,
I like to see Jconsole get appended too, But It did not.


I wonder, what configuration I should use to enable jmx logging, so that I
can see them in JConsole?

is there any documentation other than this
http://logging.apache.org/log4j/2.x/manual/jmx.html,

it would be great if above documentation is updated with a sample of
log4j2.xml configuration.

Thanks

Mahesh