Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Initialization for logger is unsuccessful

Tags:

log4j

I am using the below mentioned log4j.properties file in tomcat 6.0.35

log4j.appender.request=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.request.Append=true
log4j.fileName=logs/test
log4j.appender.request.File=${log4j.fileName}.log
log4j.appender.request.RollingPolicy=org.apache.log4j.rolling.FixedWindowRollingPolicy
log4j.appender.request.RollingPolicy.FileNamePattern=${log4j.fileName}.%i.log.zip
log4j.appender.request.RollingPolicy.MinIndex=1
log4j.appender.request.RollingPolicy.MaxIndex=10

log4j.appender.request.TriggeringPolicy=org.apache.log4j.rolling.SizeBasedTriggeringPolicy
log4j.appender.request.TriggeringPolicy.MaxFileSize=10485760

log4j.appender.request.layout=org.apache.log4j.PatternLayout
log4j.appender.request.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.rootLogger=info, request

But I get the following messages returned

log4j:WARN Failed to set property [rollingPolicy] to value "org.apache.log4j.rolling.FixedWindowRollingPolicy".
log4j:WARN Failed to set property [triggeringPolicy] to value "org.apache.log4j.rolling.SizeBasedTriggeringPolicy".
log4j:WARN Please set a rolling policy for the RollingFileAppender named 'request'
log4j:WARN Failed to set property [rollingPolicy] to value "org.apache.log4j.rolling.FixedWindowRollingPolicy".
log4j:WARN Failed to set property [triggeringPolicy] to value "org.apache.log4j.rolling.SizeBasedTriggeringPolicy".
log4j:WARN Please set a rolling policy for the RollingFileAppender named 'request'
log4j:ERROR No output stream or file set for the appender named [request].

There is some problem with setting the properties in log4j configuration. Any help?

Thanks.

like image 520
user1379436 Avatar asked May 19 '26 05:05

user1379436


1 Answers

I ran into this today using apache-log4j-extras1.1.jar. After a while of wrestling I found that my log4j.jar being version 1.2.14 was the problem. I updated to 1.2.17 and it fixed my issue. Make sure it sits before any other log4j in your tomcat (or in your app).

like image 85
Paul Jowett Avatar answered May 24 '26 19:05

Paul Jowett



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!