ERROR Could not instantiate class [org.apache.log4j.rolling.RollingFileAppender]
I am using log4j-1.2.17.jar and apache-log4j-extras-1.2.17.jar.
I want to enable rolling files but when i try to startup server y recibed errors..
My log4j.properties file looks like this.
log4j.appender.LOG_CRON_SIJ=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.LOG_CRON_SIJ.append=true
log4j.appender.LOG_CRON_SIJ.encoding=UTF-8
log4j.appender.LOG_CRON_SIJ.rollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
log4j.appender.LOG_CRON_SIJ.rollingPolicy.FileNamePattern=${rootLog}/agendaNojCRONSIJ_%d{dd-MM-yyyy HH-mm-ss}.log
log4j.appender.LOG_CRON_SIJ.rollingPolicy.activeFileName=${rootLog}/agendaNojCRONSIJ.log
log4j.appender.LOG_CRON_SIJ.triggeringPolicy=org.apache.log4j.rolling.SizeBasedTriggeringPolicy
log4j.appender.LOG_CRON_SIJ.triggeringPolicy.maxFileSize=52428800
log4j.appender.LOG_CRON_SIJ.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.LOG_CRON_SIJ.layout.ConversionPattern=%d %-5p %c - %m%n
errors:
log4j:ERROR Could not instantiate class [org.apache.log4j.rolling.RollingFileAppender].
java.lang.ClassNotFoundException: org.apache.log4j.rolling.RollingFileAppender
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327)
at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:785)
...
...
...
log4j:ERROR Could not instantiate appender named "LOG_CRON_SIJ".
log4j:ERROR Could not instantiate class [org.apache.log4j.rolling.RollingFileAppender].
java.lang.ClassNotFoundException: org.apache.log4j.rolling.RollingFileAppender
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327)
at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124)
....
....
log4j:WARN Failed to set property [triggeringPolicy] to value "org.apache.log4j.rolling.SizeBasedTriggeringPolicy".
log4j:WARN Failed to set property [rollingPolicy] to value "org.apache.log4j.rolling.TimeBasedRollingPolicy".
log4j:WARN Please set a rolling policy for the RollingFileAppender named 'LOG_CRON_SIJ'
Can anybody help me???
Please check if you have required dependencies for RollingFileAppender (Apache Log4j 1.2.17 API)
in your classpath. If any class is not found in your classpath that is actually instantiating somewhere you will encounter such error. So please check the logging dependency.