Probably your log4j library is not in the correct directory.If it's in a
shared/common directory, it will be loaded only once (by the first app to
request it), and the config file will be loaded only once.

Hint: try to start using the log4j debug flag and see what's happening in
details.


Yours faithfully,

-- 
Arnauld Van Muysewinkel

On Mon, Feb 23, 2009 at 12:24 PM, alekoc <ale4349...@mail.ru> wrote:

>
> I have two web applications on one Tomcat server and would like to log each
> application into the separate "xxx.log" file. Accordingly Log4j manual I
> can
> do this, if I will use different file names, but I have a problem. Both
> logs
> go to the same "xxx.log" file! Usually to the last one, that was active.
> What is wrong in my log4j.properties?
>
> First application properties:
> <code>
> log4j.rootLogger=DEBUG, F
> log4j.appender.F=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.F.Encoding=UTF-8
> log4j.appender.F.File=${catalina.home}/logs/flat.log
> log4j.appender.F.DatePattern='.'yyyy-MM-dd
> log4j.appender.F.layout=org.apache.log4j.PatternLayout
> log4j.appender.F.layout.conversionPattern=%d{ddMMyy HHmmss} %5c{2} %5p
> %-50m
> %-18F %-12M:%-4L %t%n
> </code>
> Second application properties:
> <code>
> log4j.rootLogger=DEBUG, F
> log4j.appender.F=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.F.Encoding=UTF-8
> log4j.appender.F.File=${catalina.home}/logs/cbrs.log
> log4j.appender.F.DatePattern='.'yyyy-MM-dd
> log4j.appender.F.layout=org.apache.log4j.PatternLayout
> log4j.appender.F.layout.conversionPattern=%d{ddMMyy HHmmss} %5c{2} %5p
> %-50m
> %-18F %-12M:%-4L %t%n
> </code>
>
> The logging result in my case looks like this:
> <code>
> 040109 143812  cbrs DEBUG …
> 040109 145937  flat  INFO …
> 040109 150530  flat  INFO …
> 040109 150719  cbrs  INFO …
> 040109 150719  cbrs  INFO …
> </code>
>

Reply via email to