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 >> > >