logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: How to setup "log4j.properties" to log serveral different Web applications and log each app to different log files?
Date Wed, 27 Oct 2004 16:14:59 GMT
Hello Ying Lu,

It looks like you are mixing appenders and loggers. They are different things.

At 06:00 PM 10/27/2004, Ying Lu wrote:
>Hello all,
>
>My question is about how to setup "log4j.properties" for serveral Web 
>applications.
>
>The goal is the following:
>===================
>
>. One tomcat server running serveral Application, let's say 3: app1, app2, 
>and app3
>. Each application save its own logs into it own directory
>  app1  save logs to /pkg/logs/app1/test1.log
>  app2  save logs to /pkg/logs/app2/test2.log
>  app3  save logs to /pkg/logs/app3/test3.log
>
>
>. In servlets/java programs for these three applications,
>
>In App1:
>private final static Logger loggerApp1             = Logger.getLogger("app1");
>loggerApp1.info("... something here ...");
>
>
>In App2:
>private final static Logger loggerApp2             = Logger.getLogger("app2");
>loggerApp2.info("... something here ...");
>
>
>In App3:
>private final static Logger loggerApp3             = Logger.getLogger("app3");
>loggerApp3.info("... something here ...");
>
>
>The following is the log4j.properties file setup, but it does not work the 
>way we were expecting
>=========================================
>
>log4j.rootLogger = INFO, app1, app2, app3
>log4j.appender.app1=org.apache.log4j.RollingFileAppender
>log4j.appender.app1.File=test1.log
>log4j.appender.app1.Append=true
>log4j.appender.app1.layout=org.apache.log4j.PatternLayout
>log4j.appender.app2=org.apache.log4j.RollingFileAppender
>log4j.appender.app2.File=test2.log
>log4j.appender.app2.Append=true
>log4j.appender.app2.layout=org.apache.log4j.PatternLayout
>
>log4j.appender.app3=org.apache.log4j.RollingFileAppender
>log4j.appender.app3.File=test2.log
>log4j.appender.app3.Append=true
>log4j.appender.app3.layout=org.apache.log4j.PatternLayout
>
>Thanks a lot,
>Ly

-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      http://www.qos.ch/shop/products/eclm/  



---------------------------------------------------------------------
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