thanks

On Sun, Apr 28, 2013 at 9:27 AM, Remko Popma <rem...@yahoo.com> wrote:

> Steven,
>
> The buffer size used in FastAppenders is 256 Kb.
> Glad that with asyncRoot you are seeing logs.
>
> With asyncRoot, log events are first stored in a ringbuffer, then a
> separate thread takes them out and logs them to a file.
> Based on the log snippet you attached, it looks like we need to check if
> and how tomcat signals a shutdown and if we can pick up that signal to
> shutdown the threadpool.
> Thanks for bringing it to our attention!
>
> I have filed Jira ticket 
> LOG4J2-222<https://issues.apache.org/jira/browse/LOG4J2-222> for
> this. I will take a look and see what I can do. This may take some time.
>
> Best regards,
> Remko
>
>   ------------------------------
>  *From:* Steven Yang <kenshin...@gmail.com>
> *To:* Remko Popma <rem...@yahoo.com>
> *Sent:* Sunday, April 28, 2013 9:43 AM
> *Subject:* Re: How to use FastFile
>
> Thanks, I tried using asyncRoot and everything seems to log fine and I do
> see a lot of logs.
> And logs do seem to be flushed immediately so I do not know if the hook on
> shutdown is been called correctly or not.
>
> I am using struts and spring so I see a lot of logs (log level at DEBUG)
> just by starting up tomcat, so I am wondering when I use <root> how come I
> dont see any log at all? how much log do I have to write before it starts
> to flush out?
>
> and one thing I found is that when I use asyncRoot and when I shutdown
> tomcat I see the following message regarding to clearing references and
> thread local.
> The last one is related to log4j.
>
> 四月 28, 2013 8:34:46 上午 org.apache.catalina.loader.WebappClassLoader
> clearReferencesJdbc
> SEVERE: The web application [/test] registered the JBDC driver
> [org.h2.Driver] but failed to unregister it when the web application was
> stopped. To prevent a memory leak, the JDBC Driver has been forcibly
> unregistered.
> 四月 28, 2013 8:34:46 上午 org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreads
> SEVERE: The web application [/test] appears to have started a thread named
> [pool-2-thread-1] but has failed to stop it. This is very likely to create
> a memory leak.
> 四月 28, 2013 8:34:46 上午 org.apache.catalina.loader.WebappClassLoader
> clearThreadLocalMap
> SEVERE: The web application [/test] created a ThreadLocal with key of type
> [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@454e119d]) and a
> value of type [com.opensymphony.xwork2.inject.ContainerImpl] (value
> [com.opensymphony.xwork2.inject.ContainerImpl@8667df7]) but failed to
> remove it when the web application was stopped. This is very likely to
> create a memory leak.
> 四月 28, 2013 8:34:46 上午 org.apache.catalina.loader.WebappClassLoader
> clearThreadLocalMap
> SEVERE: The web application [/test] created a ThreadLocal with key of type
> [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@d7e770]) and a
> value of type [org.apache.logging.log4j.core.impl.Log4jLogEvent] (value
> [Logger=org.springframework.beans.factory.support.DefaultListableBeanFactory
> Level=INFO Message=Destroying singletons in
> org.springframework.beans.factory.support.DefaultListableBeanFactory@61e118f9:
> defining beans
> [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframewo...
>
> I am trying this on tomcat 6.0.29.
> However the thing is that I dont see the message when I use <root>.
>
>
>
> On Sun, Apr 28, 2013 at 12:07 AM, Remko Popma <rem...@yahoo.com> wrote:
>
> Steven,
>
> In your config, instead of <root>, try <asyncRoot>. You need the disruptor
> jar on the classpath. This will result in events being flushed to disk
> immediately, but in an efficient way: in batches, not one by one.
>
> I need to take a look at the behavior on Tomcat shutdown. There is a
> shutdown hook that should flush remaining events, but perhaps you found a
> bug.
>
> Can you try <asyncRoot> and let me know if that resolves the issue?
>
> Sent from my iPhone
>
> On 2013/04/27, at 23:27, Steven Yang <kenshin...@gmail.com> wrote:
>
> Thanks Remko for the comment
>
> Ok I now understand why I dont see the log.
> I am running in a tomcat, but when I shutdown my web server I dont see log
> being flushed out to file.
> Does that mean even when I run my application for a while and even after
> some logs are flushed out then I shutdown my server there will be some log
> entries left in memory and lost?
>
>
> On Sat, Apr 27, 2013 at 6:51 PM, Remko Popma <rem...@yahoo.com> wrote:
>
> (Including Steven in recipients)
>
> Sent from my iPhone
>
> On 2013/04/27, at 19:06, Remko Popma <rem...@yahoo.com> wrote:
>
> > Two more things:
> >
> > disruptor 3.0.1 is fine.
> >
> > Your layout pattern doesn't actually use location, so if you use Async
> (Logger or Appender) I'd recommend you set includeLocation=false for better
> performance.
> >
> > Remko
> >
> > Sent from my iPhone
> >
> > On 2013/04/27, at 18:59, Remko Popma <rem...@yahoo.com> wrote:
> >
> >> Hi,
> >>
> >> FastFile appenders are buffered.
> >> You won't see output in the log file until you log a lot.
> >>
> >> To see output immediately you should either specify immediateFlush=true
> or use Async Loggers or AsynchAppender (they will auto-flush efficiently).
> >>
> >> Hope this helps,
> >> Remko
> >>
> >> Sent from my iPhone
> >>
> >> On 2013/04/27, at 18:36, Steven Yang <kenshin...@gmail.com> wrote:
> >>
> >>> I am using log4j beta5 and want to try async file appender FastFile.
> >>> However I could not get it to work.
> >>> I have built the disruptor jar using project from
> >>> https://github.com/LMAX-Exchange/disruptor so my disruptor is 3.0.1
> not
> >>> 3.0.0, dont know if it matters.
> >>>
> >>> I simply follow the sample setup from
> >>> http://logging.apache.org/log4j/2.x/manual/async.html#Performance.
> >>>
> >>> But I could not see anything log into my log file, I can see the log
> file
> >>> created but nothing inside.
> >>> If I simply change from FastFile to File, I can see all the logs that
> >>> suppose to appear.
> >>> I have the following jars in my project
> >>> log4j-api-2.0-beta5.jar
> >>> log4j-core-2.0-beta5.jar
> >>> log4j-jcl-2.0-beta5.jar
> >>> log4j-slf4j-impl-2.0-beta5.jar
> >>>
> >>> In my project I mainly use slf4j but even if I try to use log4j api
> direct,
> >>> it still doesnt work.
> >>>
> >>> here is my log4j2.xml
> >>>
> >>> <configuration status="DEBUG">
> >>>  <appenders>
> >>>  <FastFile name="FastFile"
> >>> fileName="D:/Projects/TestingProject/logs/log4jtest.log"
> >>> immediateFlush="false" append="false" suppressExceptions="false">
> >>>    <PatternLayout>
> >>>      <pattern>%d %p %c{1.} [%t] %m %ex%n</pattern>
> >>>    </PatternLayout>
> >>>  </FastFile>
> >>> </appenders>
> >>> <loggers>
> >>>  <root level="debug" includeLocation="true">
> >>>    <appender-ref ref="FastFile"/>
> >>>  </root>
> >>> </loggers>
> >>> </configuration>
> >>>
> >>> What am I doing wrong? or do I need to check for any dependency for
> >>> disruptor?
> >>>
> >>> Thanks
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
>
>
>
>
>
>

Reply via email to