Jacob Kjome
Mon, 19 Jul 2010 10:27:29 -0700
In this situation, the log4j.jar in the server classpath would take precedence to any log4j.jar you included in WEB-INF/lib and be unable to find the rolling.RollingFileAppender located in the extras jar stored in WEB-INF/lib.
You can resolve this either by placing the extras jar in the server classpath alongside the log4j.jar already there or configure your application to use child-first classloading.
Jake On Mon, 19 Jul 2010 22:27:11 +0530 "Saurabh Agrawal" <saurabh.agra...@criticalpath.net> wrote:
Hi Friends,Tomcat version: apache-tomcat-5.5.27Operating System: SunOS 10.0 / LinuxProblem:I've tried many times to configure apache-log4j-extras-1.0 with apache-log4j-1.2.16, but it is still failing to load classes from configureapache-log4j-extras-1.0 JAR file.What I want to do: Actually I want to do time based log rotation the my application specific log files. I could able to configure using 'net.cp.ps.sdk.util.log.DailyRollingFileAppender' class, but few problemsare reported on Apache site for this class.Solution I can think of: So, I have to look for another option for 'net.cp.ps.sdk.util.log.DailyRollingFileAppender' class, and I found 'org.apache.log4j.rolling.RollingFileAppender' class and can use'org.apache.log4j.rolling.TimeBasedRollingPolicy' in that.Steps I performed so far:1. Downloaded apache-log4j-extras-1.0 with apache-log4j-1.2.16 JAR filesfrom web. 2. Renamed apache-log4j-1.2.16.jar to simple 'log4j.jar'.3. Copied apache-log4j-extras-1.0.jar in ~/WEB-INF/lib directory, where myold log4j is present. 4. Extracted new log4j.jar (1.2.16).5. Edited the pom.xml file from new 'log4j.jar' to include 'apache-log4j-extras-1.0'. Steps are described here: ( <https://wiki.jasig.org/display/UPM30/log4j.xml>https://wiki.jasig.org/display/UPM30/log4j.xml). 6. Created jar file again, after editing pom.xml.7. Then I added following configuration block, in my application specific log-conf.xml (present in ~/WEB-INF/etc/):<!-- Presentation Server Access log appender --><appender name="access-log"class="org.apache.log4j.rolling.RollingFileAppender"> <File>WEB-INF/log-files/access.log</File><rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> <FileNamePattern>WEB-INF/log-files/access.log.%d{yyyy-MM-dd}.log</FileNamePattern> </rollingPolicy> <layout class="org.apache.log4j.PatternLayout"><param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss,SSS} [%t] %c %x%n %-5p - %m%n"/> </layout></appender> but, still I am getting following exception:7202 [main] WARN net.cp.ps.sdk.server.ServerConfig - thread[main] Unable to parse invite request mappings: [The XPath='invite-requests/invite-mapping'does not exist]7214 [main] WARN net.cp.ps.sdk.server.ServerConfig - thread[main] Unable to parse known profiles request mappings: [TheXPath='known-profiles-requests/known-profiles-mapping' does not exist]8114 [main] ERROR net.cp.ps.sdk.server.ServerConfig - thread[main] Missingconfiguration: couldn't find value for /ps-conf/regex-whitespace-keyword log4j:ERROR Could not create an Appender. Reported error follows.java.lang.ClassNotFoundException:org.apache.log4j.rolling.RollingFileAppenderat org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386)at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) atjava.lang.Class.forName0(Native Method)at java.lang.Class.forName(Class.java:164) atorg.apache.log4j.helpers.Loader.loadClass(Loader.java:160)Can someone please help me with this, what's going wrong and what I ammissing here?Thanks in advance.Regards, Saurabh Agrawal
--------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org