You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kurt Wiersma <kw...@fastemailer.com> on 2002/09/16 21:01:58 UTC

log4j props not getting pick up

I am try to use commons-logging (I have version 1.0.1) with struts
1.1b2 under Tomcat 4.1.8. I get my log statements outputed to the
%CATALINA_HOME/logs/catalina.out (which is stout?) just fine. However
the log4j rolling log file that I have specified doesn't get created.
Furthermore the format of the log message in catalina.out is not the
same as what I specified in my log4j.properties. I think that my lo4j
properties aren't being picked up.

In my action class I get a logger like this:

private Log log = new LogFactory("com.kdub.DIS");

My commons-logging.properties located in WEB-INF/classes looks like
this:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLogyImpl
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory

My log4j.properties located in WEB-INF/classes looks like this:

log4j.rootLogger=DEBUG,stdout,R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%p [%t] [%c]
%C{1}.%M(%L) | %m%n

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/usr/local/tomcat/logs/dis-log.txt

log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

log4j.logger.org.apache=INFO
log4j.logger.org.apache.commons=WARN

Any suggestions on this is happening would be most appreciated! :)

Thanks,

--Kurt

-------------------------------------------- 
  Kurt Wiersma
  Software Developer
  http://www.stolaf.edu/people/wiersma/
  kwiersma@fastemailer.com
--------------------------------------------

-- 
http://fastmail.fm - Access all of your messages and folders wherever
you are

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: log4j props not getting pick up

Posted by Eddie Bush <ek...@swbell.net>.
Try changing:

private Log log = new LogFactory("com.kdub.DIS");

to

private Log log = new LogFactory.getLog(MyActionClass.class);
-- or --
private Log log = new LogFactory.getLog("com.kdub.DIS");

Regards,

Eddie

Kurt Wiersma wrote:

>I am try to use commons-logging (I have version 1.0.1) with struts
>1.1b2 under Tomcat 4.1.8. I get my log statements outputed to the
>%CATALINA_HOME/logs/catalina.out (which is stout?) just fine. However
>the log4j rolling log file that I have specified doesn't get created.
>Furthermore the format of the log message in catalina.out is not the
>same as what I specified in my log4j.properties. I think that my lo4j
>properties aren't being picked up.
>
>In my action class I get a logger like this:
>
>private Log log = new LogFactory("com.kdub.DIS");
>
>My commons-logging.properties located in WEB-INF/classes looks like
>this:
>
>org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLogyImpl
>org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory
>
>My log4j.properties located in WEB-INF/classes looks like this:
>
>log4j.rootLogger=DEBUG,stdout,R
>
>log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>
># Pattern to output the caller's file name and line number.
>log4j.appender.stdout.layout.ConversionPattern=%p [%t] [%c]
>%C{1}.%M(%L) | %m%n
>
>log4j.appender.R=org.apache.log4j.RollingFileAppender
>log4j.appender.R.File=/usr/local/tomcat/logs/dis-log.txt
>
>log4j.appender.R.MaxFileSize=100KB
>log4j.appender.R.MaxBackupIndex=1
>
>log4j.appender.R.layout=org.apache.log4j.PatternLayout
>log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
>
>log4j.logger.org.apache=INFO
>log4j.logger.org.apache.commons=WARN
>
>Any suggestions on this is happening would be most appreciated! :)
>
>Thanks,
>
>--Kurt
>
>-------------------------------------------- 
>  Kurt Wiersma
>  Software Developer
>  http://www.stolaf.edu/people/wiersma/
>  kwiersma@fastemailer.com
>--------------------------------------------
>

-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: log4j props not getting pick up

Posted by René Eigenheer <re...@bridgesolutions.net>.
I had the same problem with 1.1b2 and Tomcat 4.0.4

I solved it with changing the sequence of log4j.jar and commons-logging.jar
in my classpath

Rene

> -----Original Message-----
> From: Kurt Wiersma [mailto:kwiersma@fastemailer.com]
> Sent: Montag, 16. September 2002 21:02
> To: struts-user@jakarta.apache.org
> Subject: log4j props not getting pick up
>
>
> I am try to use commons-logging (I have version 1.0.1) with struts
> 1.1b2 under Tomcat 4.1.8. I get my log statements outputed to the
> %CATALINA_HOME/logs/catalina.out (which is stout?) just fine. However
> the log4j rolling log file that I have specified doesn't get created.
> Furthermore the format of the log message in catalina.out is not the
> same as what I specified in my log4j.properties. I think that my lo4j
> properties aren't being picked up.
>
> In my action class I get a logger like this:
>
> private Log log = new LogFactory("com.kdub.DIS");
>
> My commons-logging.properties located in WEB-INF/classes looks like
> this:
>
> org.apache.commons.logging.Log=org.apache.commons.logging.impl
> .Log4JCategoryLogyImpl
> org.apache.commons.logging.LogFactory=org.apache.commons.loggi
> ng.impl.Log4jFactory
>
> My log4j.properties located in WEB-INF/classes looks like this:
>
> log4j.rootLogger=DEBUG,stdout,R
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>
> # Pattern to output the caller's file name and line number.
> log4j.appender.stdout.layout.ConversionPattern=%p [%t] [%c]
> %C{1}.%M(%L) | %m%n
>
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=/usr/local/tomcat/logs/dis-log.txt
>
> log4j.appender.R.MaxFileSize=100KB
> log4j.appender.R.MaxBackupIndex=1
>
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
>
> log4j.logger.org.apache=INFO
> log4j.logger.org.apache.commons=WARN
>
> Any suggestions on this is happening would be most appreciated! :)
>
> Thanks,
>
> --Kurt
>
> --------------------------------------------
>   Kurt Wiersma
>   Software Developer
>   http://www.stolaf.edu/people/wiersma/
>   kwiersma@fastemailer.com
> --------------------------------------------
>
> --
> http://fastmail.fm - Access all of your messages and folders wherever
> you are
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>