logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: catalina logging stopped after install log4j.jar
Date Wed, 29 Aug 2007 18:03:39 GMT
On Wed, 29 Aug 2007 19:20:16 +0200
  Oscar Segarra Rey <osegarra@gencat.net> wrote:
> Hi, 
> 
> 
> 
> I have reinstalled tomcat5.5.23 in a tomcat clustered environment in a W2003 
>SP2 operating system.
> 
> 
> 
> With the default configuration everything worked perfectly but due to 
>developement requirements I had to put log4j.jar in the commons\lib path and 
>afterwareds system no longer wrote on my catalina.[DATE].log file.
> 
> 

What do you mean the "default configuration"?  Are you saying that you didn't 
use Log4j before?  In order for Tomcat to use Log4j (in Tomcat 5.5.xx, at 
least, it's different tin 6.xx) you need log4j.jar and commons-logging.jar in 
common/lib.  Then you need log4j.properties in common/classes.

> 
> What's happening ?
> 
> Is there any way to configure log4j.properties in order to get the same 
>loggin information in the same file ?
> 

Sure.  Define a DailyRollingFileAppender.  Or, if you start up using the 
Windows Servive, just define a ConsoleAppender and the service will take care 
of the log file (by date, just as you want it to be).  Here's the essence of 
my config file (notice that I use the Windows Service and use the log to 
ConsoleAppender technique just described)...


log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p [%-8.8t]: %39.39c %-6r - %m%n

log4j.appender.LOCALHOST=org.apache.log4j.RollingFileAppender
log4j.appender.LOCALHOST.File=${catalina.base}/logs/localhost.log
log4j.appender.LOCALHOST.MaxFileSize=1000KB
log4j.appender.LOCALHOST.MaxBackupIndex=1
log4j.appender.LOCALHOST.layout=org.apache.log4j.PatternLayout
log4j.appender.LOCALHOST.layout.ConversionPattern=%-5p [%-8.8t]: %39.39c %-6r 
- %m%n

log4j.appender.MYAPP=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MYAPP.File=${catalina.base}/logs/localhost_myapp.log
log4j.appender.MYAPP.DatePattern='.'yyyy-MM-dd
log4j.appender.MYAPP.layout=org.apache.log4j.PatternLayout
log4j.appender.MYAPP.layout.ConversionPattern=%c{1} %-6r - %m%n

log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp]=INFO,

MYAPP
log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp]=false

log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO, 
LOCALHOST
log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=false

log4j.rootLogger=INFO, A1



Jake

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


Mime
View raw message