You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Saurabh Agrawal <sa...@criticalpath.net> on 2010/06/24 13:37:55 UTC

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

Hi Friends,

 

Tomcat version: apache-tomcat-5.5.27

Operating System: SunOS 10.0 / Linux

 

Question:

 

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/):

<!-- 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</FileNamePa
ttern>
             </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: [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.jav
a:1386)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a: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 and what I am
missing here?

Thanks in advance.

Regards,
Saurabh Agrawal


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

Posted by Pid <pi...@pidster.com>.
On 24/06/2010 12:37, Saurabh Agrawal wrote:
> Hi Friends,
> 
> Tomcat version: apache-tomcat-5.5.27
> 
> Operating System: SunOS 10.0 / Linux
> 
> Question:
> 
> 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/):
> 
> <!-- 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</FileNamePa
> ttern>
>              </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: [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.jav
> a:1386)
>         at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
> a: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 and what I am
> missing here?
> 
> Thanks in advance.

This is probably a question better directed to the Log4J users list,
rather than the Tomcat users list.


p






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

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Saurabh,

On 6/25/2010 1:23 AM, Saurabh Agrawal wrote:
> Please refer first line in following API doc, you will find that two
> problems are reported in it and option suggested us
> TimeBasedRollingPolicy.
> 
> http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html
>
>  "DailyRollingFileAppender has been observed to exhibit
> synchronization issues and data loss............."

Oh, I had never seen that. Good to know. You're still using an exotic
appender, though. The one I see in log4j-extras is
org.apache.logging.rolling.RollingFileAppender

You ought to be able to just put apache-log4j-x.y.z.jar and
apache-log4j-extras-x.y.z.jar into WEB-INF/lib and it should work. Are
you trying to configure app-based logging, or do you also want
server-based logging to use log4j? If the latter, you need both of those
JAR files in Tomcat's lib directory, too.

Can you post more of the stack trace that you see? That one looked
incomplete.

>>> Copied apache-log4j-extras-1.0.jar in ~/WEB-INF/lib directory,
>>> where my old log4j is present.
> 
> I've put both Jars in <TOMCAT_HOME>/webapps/cp/WEB-INF/lib/
> directory. Restarting tomcat (catalina.out) shows that it has picked
> up both the JAR files, still it is saying that "Failing to load
> class.......".
> 
> This confirms that above path "<TOMCAT_HOME>/webapps/cp/WEB-INF/lib/"
> is set in PATH variable.

The PATH environment variable is not relevant, here.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwkz/MACgkQ9CaO5/Lv0PDbaQCglslKES/aPLlpsUhorqAvLyXD
75EAn3kJTPqfDvXs4yhvmKl3pcdeRmCz
=zpYi
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


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

Posted by Saurabh Agrawal <sa...@criticalpath.net>.
Hi Pid and Chris,

Thanks for your response.

I've tried registering myself to log4j mailing list, but remote MTA is giving some error and subscription is failing to validate.

Chris,

Please refer first line in following API doc, you will find that two problems are reported in it and option suggested us TimeBasedRollingPolicy.

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html

"DailyRollingFileAppender has been observed to exhibit synchronization issues and data loss............."

Pid,

>> Copied apache-log4j-extras-1.0.jar in ~/WEB-INF/lib directory, where my old log4j is present.

I've put both Jars in <TOMCAT_HOME>/webapps/cp/WEB-INF/lib/ directory. Restarting tomcat (catalina.out) shows that it has picked up both the JAR files, still it is saying that "Failing to load class.......".

This confirms that above path "<TOMCAT_HOME>/webapps/cp/WEB-INF/lib/" is set in PATH variable.

Thanks,
Saurabh Agrawal

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Thursday, June 24, 2010 9:04 PM
To: Tomcat Users List
Subject: Re: Cannot configure apache-log4j-extras-1.0 with apache-log4j-1?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Saurabh,

On 6/24/2010 7:37 AM, Saurabh Agrawal wrote:
> 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.

Pid's right: this is a log4j question, not a Tomcat one, unless you've got those JAR files in fully places. Where have you put those JAR files?

> 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.

What's wrong with org.apache.log4j.DailyRollingFileAppender?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwjewMACgkQ9CaO5/Lv0PC65gCfbNYe4bSxe6GYcyK56xo8EC0p
Xo0AnieVBi7UyuPXBF0pMEkTOiFOyokK
=blf6
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


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

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Saurabh,

On 6/24/2010 7:37 AM, Saurabh Agrawal wrote:
> 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.

Pid's right: this is a log4j question, not a Tomcat one, unless you've
got those JAR files in fully places. Where have you put those JAR files?

> 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.

What's wrong with org.apache.log4j.DailyRollingFileAppender?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwjewMACgkQ9CaO5/Lv0PC65gCfbNYe4bSxe6GYcyK56xo8EC0p
Xo0AnieVBi7UyuPXBF0pMEkTOiFOyokK
=blf6
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Nothing helps

Posted by Pid <pi...@pidster.com>.
On 24/06/2010 13:08, yuccanel@live.co.za wrote:
> Perhaps I misunderstood a few things and am trying to force something
> that works on my test rig to work in production?
> Can a <resource be shared between tomcat authentication and hibernate?
> Should I let hibernate manage it's own <resource> and give tomcat it's
> own seperate<resource > for authentication?
> 
> any help is hugely appreciated.

Not going to happen as long as you keep hijacking other peoples threads.
Please stop it.


p

> --------------------------------------------------
> From: "Saurabh Agrawal" <sa...@criticalpath.net>
> Sent: Thursday, June 24, 2010 1:37 PM
> To: <us...@tomcat.apache.org>
> Subject:  Cannot configure apache-log4j-extras-1.0 with apache-log4j-1?
> 
>> Hi Friends,
>>
>>
>>
>> Tomcat version: apache-tomcat-5.5.27
>>
>> Operating System: SunOS 10.0 / Linux
>>
>>
>>
>> Question:
>>
>>
>>
>> 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/):
>>
>> <!-- 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</FileNamePa
>>
>> ttern>
>>             </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: [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.jav
>>
>> a:1386)
>>        at
>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
>>
>> a: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 and what I am
>> missing here?
>>
>> Thanks in advance.
>>
>> Regards,
>> Saurabh Agrawal
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



Nothing helps

Posted by yu...@live.co.za.
Perhaps I misunderstood a few things and am trying to force something that 
works on my test rig to work in production?
Can a <resource be shared between tomcat authentication and hibernate?
Should I let hibernate manage it's own <resource> and give tomcat it's own 
seperate<resource > for authentication?

any help is hugely appreciated.

--------------------------------------------------
From: "Saurabh Agrawal" <sa...@criticalpath.net>
Sent: Thursday, June 24, 2010 1:37 PM
To: <us...@tomcat.apache.org>
Subject:  Cannot configure apache-log4j-extras-1.0 with apache-log4j-1?

> Hi Friends,
>
>
>
> Tomcat version: apache-tomcat-5.5.27
>
> Operating System: SunOS 10.0 / Linux
>
>
>
> Question:
>
>
>
> 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/):
>
> <!-- 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</FileNamePa
> ttern>
>             </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: [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.jav
> a:1386)
>        at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
> a: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 and what I am
> missing here?
>
> Thanks in advance.
>
> Regards,
> Saurabh Agrawal
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org