I’m having this wierd issue with my log4JAppender.
Im using a dailyRollingFileAppender and the configuration for the same is as follows:
#---------------------------------------------------------------------------------------
# Log config for the Web
#---------------------------------------------------------------------------------------
log4j.appender.aWeb = org.apache.log4j.DailyRollingFileAppender
log4j.appender.aWeb.DatePattern = '.'yyyy-MM-dd'.log'
log4j.appender.aWeb.file = @LOG_DIR@/web.log
log4j.appender.aWeb.layout = org.apache.log4j.PatternLayout
log4j.appender.aWeb.layout.ConversionPattern = [ %d [%t] %C{2}.%M():%L %X{USER_NAME}%x %-5p]: %m%n
Now , my main log file works just fine, the issue occurs with the daily rolled files that are being created.
The daily rolling file, does not have the full log, instead its truncated.
A few observations:
1. The truncation is not based on the length, i.e different files have different amount of logged data in them
2. Maybe , the number of log statements might be the same, i.e after 20 log statements the log is truncated , or maybe something similar.
I am not sure why this is happening, has someone already faced this issue, if not what might be the possible workarounds for the same.
Thanks
I haven’t run in the issue you are encountering with the DailyRollingFileAppender but I would recommend the
RollingFileAppenderin combination with theTimeBasedRollingPolicyfrom the log4j extras package – http://logging.apache.org/log4j/companions/extras/index.htmlThis has been working fine for us. No issue with truncation. Sample config below.