tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Tomcat Commons logging and log4j
Date Tue, 16 Oct 2007 11:57:08 GMT
Martyn Hiemstra wrote:
> Hi All,
> I have been working with tomcat and log4j for a while and it worked
> perfectly. Now I have updated all my web apps to use commons logging. I
> have discovered that the Tomcat developers have absolutly no idea how to
> do something right when it comes to commons logging and I am curious to
> why.

Non-specific insults are likely to generate attention, but unlikely to
encourage help.  Never-the-less, I will attempt to assist.

> I tried tomcat 5.028 and commons logging. I discovered that tomcat used
> it's own commons-logging-api.jar file and it was impossible to override
> this commons logging file.

commons-logging-api is not the same as commons-logging

> I am running tomcat 6 now and I have discovered that tomcat 6 uses
> commons logging without log4j enabled.

log4j is 'enabled' when you configure it and supply the jar file.

> I have log4j.jar and commons-logging-1.1.jar in my webapp\WEB-INF\lib
> directory and I put my file in the
> webapp\WEB-INF\classes ditrectory so this should be correct. 

Sounds just like the configuration I am using, successfully I might add.

> If I create a FileAppender like this:
> log4j.appender.fileout=org.apache.log4j.RollingFileAppender
> log4j.appender.fileout.File=/tmp/myLog.log
> log4j.appender.fileout.MaxFileSize=1024KB
> log4j.appender.fileout.MaxBackupIndex=1
> log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
> log4j.appender.fileout.layout.conversionPattern=[%-6p] %-13d{ABSOLUTE}
> %-26C{1} %-4L %m%n
> I have discovered that the /tmp/myLog.log is created but nothing is
> outputed to this file.

>From the obvious questions department:

* have you set a logging level that will permit log messages to be
written to the file?

* what attributes are set in your application context configuration?

> I am curious, why have the tomcat developers disabled something that is
> so commonly used?

It's not disabled, you are probably doing something wrong. Log4J works
perfectly well if it's configured correctly.


> Thanks in advance,
> Martyn
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message