tags:

views:

54

answers:

2

I am using log4j in my java application, but after some time without throwing any exception it stopped logging

my log4j configuration is as below.

log4j.rootLogger=INFO,FILE
log4j.appender.FILE=com.test.TestFIleAppender
log4j.appender.FILE.MaxFileSize=20MB
log4j.appender.FILE.MaxBackUpIndex=200

My file appender contains some code to do the zip operation and to specify the log file format and all.

This was logging fine for some time, but suddenly stopped logging , no exception also thrown

can any body tell me what can be the issue?

any body know any log4j related issues like this?

+1  A: 

It is difficult to answer, why your logging is stopping.

First, check the hard disk space, whether this is full.

Than write a testcase in which a thread is polling a logging message of type INFO every second. Than you could check whether this is a space or memory issue.

Please notice: When you programm is waiting somewhere and no thread or action is working, you will not see any loging message. Please check, by debugging, whether a code line is executed in a loop (or as you expected to see messages) in which a logging message should be shown.

This is an example of my log4j properties file. May be is is helpful:

log4j.rootLogger=INFO, stdout, logfile

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p (%t) [%c] - %m%n

log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=C:/log/client.log
log4j.appender.logfile.MaxFileSize=5MB
log4j.appender.logfile.MaxBackupIndex=0
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
Markus Lausberg
actualy disc space and my application is ok, basically my application is server, it able to process requests and all... but trace not printing
sreejith
my log4j file is also simiilar... u know any known problems in log4j like this
sreejith
Is their a reason, why you are using your own FileAppender?
Markus Lausberg
i have some logic of createing zipfiles of old log files and appending timestamp to newly created log files and all
sreejith
A: 

Have you considered the possibility that log4j is still writing to a file, but that file has been unlinked from its parent directory by your custom appender?

Stephen C