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?
The Log4j logging settings are stored in the file app_data /conf/server/log4j. properties, where app_data is the application data folder. You can edit this file directly on the server or open it by clicking Settings > Logging.
By default, log4j2 will look for a configuration file named log4j2. xml on the classpath. Note the “2” in the file name!
log4j-core is the implementation of this interface, so it contains actual code. It implements every interface in the API. So basically when you import the Logger class, you import it from the API library. And when you call LogManager.
This happened to me. Working one day and then not working the next. I went back and realized I had changed the POM dependencies and did some googling.
When I corrected this issue, my logging returned. I would make sure you have the following artifacts in sync:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
http://www.slf4j.org/manual.html
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With