Hi Jake.

Thanks for all your help. It's working now.

Saurabh
-----Original Message-----
From: Jacob Kjome [mailto:h...@visi.com] 
Sent: Wednesday, July 21, 2010 8:29 PM
To: Log4J Users List; saurabh.agra...@criticalpath.net
Subject: Re: Cannot configure apache-log4j-extras-1.0 with apache-log4j-1
for time based log rotation

On Wed, 21 Jul 2010 02:13:21 +0530
  "Saurabh Agrawal" <saurabh.agra...@criticalpath.net> wrote:
> Thanks Jake.
> 
> Yes, I am running server in standalone mode (~/bin/startup.sh) [OS - 
> Linux/Solaris]. No IDE is being used.
> My application is deployed on tomcat server under ~/webapps/cp/.
> 
> I couldn't find my application specific pom.xml file, so I did update 
> the one present in log4j.jar. If that is not the correct way to do 
> this, can I use web.xml to define dependency?
> 

The instructions presume you are using Maven2 to perform your builds.
Apparently that is not the case for you.  Modifying pom.xml inside log4j.jar
will do you no good (nor harm).  It is totally inconsequential to your
issue.

Whatever build you are using (Ant?), make sure that it places the following
2 jars inside WEB-INF/lib of your WAR file (or directory)....

~/webapps/cp/WEB-INF/lib/log4j.jar
~/webapps/cp/WEB-INF/lib/log4j-extras.jar

> Also, we are using ~/webapps/cp/WEB-INF/etc/log-conf.xml file to add 
> following configuration:
> 
> <!-- 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</File
> NamePa
> 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>
> 

Like I mentioned before, this configuration looks like it is for Logback.  
Log4j doesn't support stuff like <File> and <FileNamePattern> elements.  The

link you originally provided gives you the correct configuration info....

https://wiki.jasig.org/display/UPM30/log4j.xml

And that doc points to this doc, which provides the defacto information...


http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/r
olling/TimeBasedRollingPolicy.html
> What I want is that a new log file should be created in the mid night, and
> logging should be continued in that file. Old log file should be renamed
> with access.log.<date>.

Read the above links.  They provide all the information you need.

Jake

> 
> Regards,
> Saurabh Agrawal
> 
> -----Original Message-----
>From: Jacob Kjome [mailto:h...@visi.com] 
> Sent: Tuesday, July 20, 2010 3:21 AM
> To: Log4J Users List; saurabh.agra...@criticalpath.net
> Subject: Re: Cannot configure apache-log4j-extras-1.0 with apache-log4j-1
> for time based log rotation
> 
> On Tue, 20 Jul 2010 00:57:48 +0530
>  "Saurabh Agrawal" <saurabh.agra...@criticalpath.net> wrote:
>> Sorry, Jake. But I think you've missed the server name in my first email.
>> It's Apache Tomcat.
>> 
>> ***
>> Tomcat version: apache-tomcat-5.5.27
>> ***
> 
> Whoops.  I guess I did miss that.   That presents a problem, though. 
Tomcat
> uses child-first classloading by default, at least when running under the
> standalone scripts.
> 
> How are you running it?  Are you running it within an IDE or something?
> 
> Also, I took a closer look at your config.  It looks like Logback
> configuration, not Log4j configuration.  See here for config...
> 
>
http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/r
> olling/RollingFileAppender.html
> 
> The config at the link you mentioned (
> https://wiki.jasig.org/display/UPM30/log4j.xml ) actually looks correct to
> me, but is different than what you mentioned below.
> 
> You also mention that you edited the pom.xml file in log4j.jar?  That's
not
> he pom file to edit.  The pom.xml to edit is your own pom.xml to contain
the
> dependency.
> 
> Please check the resultant WAR file to ensure that the files you think are
> supposed to be there actually are there.
> 
> 
> Jake
> 
>> 
>> Thanks for your help.
>> 
>> Regards,
>> Saurabh Agrawal
>> 
>> -----Original Message-----
>>From: Jacob Kjome [mailto:h...@visi.com] 
>> Sent: Tuesday, July 20, 2010 12:38 AM
>> To: Log4J Users List; saurabh.agra...@criticalpath.net
>> Subject: Re: Cannot configure apache-log4j-extras-1.0 with apache-log4j-1
>> for time based log rotation
>> 
>> What server do you use?  This should be part of your server
documentation,
>> but if it's Weblogic I might be able to tell you.  But that also depends
> on
>> the server version.
>> 
>> 
>> Jake
>> 
>> On Tue, 20 Jul 2010 00:00:37 +0530
>>  "Saurabh Agrawal" <saurabh.agra...@criticalpath.net> wrote:
>>> Dear Jake,
>>> 
>>> Thanks for replying this query.
>>> Could you please tell me how to configure the application to use 
>>> child-first classloading?
>>> 
>>> Regards,
>>> Saurabh Agrawal
>>> 
>>> -----Original Message-----
>>>From: Jacob Kjome [mailto:h...@visi.com]
>>> Sent: Monday, July 19, 2010 10:54 PM
>>> To: Log4J Users List; saurabh.agra...@criticalpath.net
>>> Subject: Re: Cannot configure apache-log4j-extras-1.0 with 
>>>apache-log4j-1  for time based log rotation
>>> 
>>> My guess is that you have classloading issues.  What server are you
> using?
>>> I'll bet it is not configured to use child-first (a.k.a parent-last) 
>>> classloading and that the server has a copy of log4j.jar in the server 
>>> classpath.
>>> 
>>> 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.27
>>>> 
>>>> Operating System: SunOS 10.0 / Linux
>>>> 
>>>> 
>>>> 
>>>> 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>
>>>> 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</Fil
>>>> e
>>>> NamePa
>>>> 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(WebappClassLoa
>>>> d
>>>> er.jav
>>>> a:1386)
>>>> 
>>>> at
>>>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
>>>> d
>>>> er.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: log4j-user-unsubscr...@logging.apache.org
>>>For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>>For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>> 
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>For additional commands, e-mail: log4j-user-h...@logging.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>For additional commands, e-mail: log4j-user-h...@logging.apache.org
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to