Cannot configure apache-log4j-extras-1.0 with apache-log4j-1????

2010-06-25 Thread aalok95

Hi Friends,

Problem:
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 configure
apache-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 problems
are 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 files
from 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 my
old 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).
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/):


  
 WEB-INF/log-files/access.log
 
   WEB-INF/log-files/access.log.%d{-MM-dd}.log
 
 
   
 
  

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: [The
XPath='known-profiles-requests/known-profiles-mapping' does not exist]
8114 [main] ERROR net.cp.ps.sdk.server.ServerConfig  - thread[main] Missing
configuration: 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.RollingFileAppender
at
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.apache.log4j.helpers.Loader.loadClass(Loader.java:160)


Can someone please help me with this, what's going wrong?

Thanks in advance.

Regards,
Saurabh Agrawal
-- 
View this message in context: 
http://old.nabble.com/Cannot-configure-apache-log4j-extras-1.0-with-apache-log4j-1-tp28995244p28995244.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


Re: Cannot configure apache-log4j-extras-1.0 with apache-log4j-1????

2010-06-25 Thread Jacob Kjome

This a clearly a classloading/environment issue unique to uPortal.  I suggest 
you
ask on their list.  There's nothing I can see that Log4j is doing wrong, at 
least
not at this point.  In any more standard environment, like Tomcat6, placing
log4j.jar and log4j-extras.jar in WEB-INF/lib would work fine.

One thing you could check is the type of classloading behavior you have
configured.  Is it parent-first (Java's standard classloading) or parent-last
(often provided by containers to deal with classloading issues unique to JEE
environments).  If parent-first, you should check if log4j.jar exists in the
server's classpath.  If it is there, then it will be loaded in preference to the
lgo4j.jar in WEB-INF/lib.  Then if log4j.jar in the server's classpath tries to
load something from log4j-extra.jar in WEB-INF/lib, it won't find it.  Most
servers allow you configure classloading behavior.  Find the option to set it to
parent-last and your problem may go away.

Jake

On 6/25/2010 12:26 PM, aalok95 wrote:
 
 Hi Friends,
 
 Problem:
 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 configure
 apache-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 problems
 are 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 files
 from 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 my
 old 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).
 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/):
 
 
   
  WEB-INF/log-files/access.log
  
WEB-INF/log-files/access.log.%d{-MM-dd}.log
  
  

  
   
 
 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: [The
 XPath='known-profiles-requests/known-profiles-mapping' does not exist]
 8114 [main] ERROR net.cp.ps.sdk.server.ServerConfig  - thread[main] Missing
 configuration: 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.RollingFileAppender
 at
 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)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:164)
 at org.apache.log4j.helpers.Loader.loadClass(Loader.java:160)
 
 
 Can someone please help me with this, what's going wrong?
 
 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