[prev in list] [next in list] [prev in thread] [next in thread]
List: log4j-user
Subject: Re: catalina logging stopped after install log4j.jar
From: "Jacob Kjome" <hoju () visi ! com>
Date: 2007-08-30 17:35:20
Message-ID: web-6633888 () mailback2 ! g2host ! com
[Download RAW message or body]
On Thu, 30 Aug 2007 09:51:07 +0200
Oscar Segarra Rey <osegarra@gencat.net> wrote:
> Hi Jake
>
> Thanks for your response.
>
> When I sayd default configuration i mean the configuration of a newly
>installed tomcat, it is the default libraries and the default server.xml.
>
Ok
> By default tomcat does not include log4j.jar.
>
Yep
> If I start tomcat with this newly installed configuration there are serveral
>logs in /logs:
>
> stdout_[DATE].log
> jakarta_service_[DATE].log
> stderr_[DATE].log
> manager_[DATE].log
> localhost_[DATE].log
> host-manager_[DATE].log
> catalina_[DATE].log
> admin_[DATE].log
>
> And system logs on most of them, including catalina_[DATE].log
>
> After including log4j.jar in the commons/lib system no longer wrote data on
>the catalina_[DATE].log and I'd like to get the same information I get before
>add the log4j.jar. Is it possible ?
>
In addition to Log4j.jar, you have to add commons-logging.jar to common/lib.
> In your configuration the date of the file names dissappear, isn't it ?
>
With my configuration (when running under the Tomcat Service, not from the
command line), I get jakarta_service_[DATE].log, stderr_{DATE}.log (though
nothing ever gets written to it, and stdout_[DATE].log. The latter is where
all Tomcat logging goes (as well as out.println() statements). You are right
that the host and context logs don't get written with the date included in the
log file, but the context log will roll with the yesterdays file being renamed
using the date. There might be another way to define log files using the
date, but I don't recall how that is configured. I don't use
DailyRollingFileAppender that much. Maybe someone else can help you out
there.
> This log4j.jar was added later in order to be used by our applications. Each
>application implements its log4j.properties.
>
Why not deploy log4j.jar with each application? If each has it's own
log4j.properteis, then that means you don't intend to share logging
configuration across applications. As such, there is no need to put log4j.jar
in common/lib. Just put it in WEB-INF/lib of each app. Note that if you
don't do this and just have log4j.jar in common/lib, you will have a single
logger repository that is shared by Tomcat and all your apps. Any app
performing a configuration will stomp on all the other apps configuration.
Unless you plan to use a repository selector to differentiate logging
repositories, ALWAYS deploy log4j.jar in WEB-INF/lib of EACH webapp.
Jake
> Thanks a lot.
>
>
> ________________________________
>
>
> Oscar Segarra
> Àrea de Tecnologies de la Informació i les Comunicacions
> Departament de la Presidència Generalitat de Catalunya
> C/ Sant Honorat, 1, 08002 - Barcelona
> Tel. 934 02 48 34
> email: osegarra@gencat.net
>
>
>
>
> -----Missatge original-----
> De: Jacob Kjome [mailto:hoju@visi.com]
> Enviat: dimecres, 29 / agost / 2007 20:04
> Per a: Log4J Users List
> Tema: Re: catalina logging stopped after install log4j.jar
>
> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic