Do you have log4j.jar in the WEB-INF/lib of both webapps? And is your
initializer doing anything other than just calling
PropertyConfigurator.confgure()? I recommend renaming your config files to
log4j.properties and placing them in WEB-INF/clases. You will then get
separated logging configuration for each webapp.
Note that in order to use a single global log4j.jar and not have log4j.jar in
WEB-INF/lib of each app and not have each app stomp on the others
configuration, you would need to install a repository selector. If you have no
idea what that is, I suggest you go with my first suggestion for now and read
up on the topic before attempting to use it. BTW, Log4j-1.3 will make this
much easier.
Jake
Quoting Julien ALLANOS <[EMAIL PROTECTED]>:
> Hi,
>
> I'm trying to get log4j working with my webapps. I have 2 webapp running on
> the
> same Tomcat 5.5 server, each one with its own log4j.rootLogger configured to
> log to stdout.
>
> So I expect to get logs from webapp1 and webapp2 in catalina.out. Each root
> logger has its own pattern and log level, so I can distinguish between the
> two
> in catalina.out. However, it seems they share the same logging configuration,
> so I get only one pattern for the two webapps. Is this the normal behaviour?
>
> Let's get into details:
>
> webapp1
> =3D=3D=3D=3D=3D=3D=3D
> /webapp1/WEB-INF/web.xml
> ------------------------
> [...]
> <servlet>
> <servlet-name>log4j-init</servlet-name>
> <servlet-class>wave.util.Log4jInit</servlet-class>
>
> <init-param>
> <param-name>log4j-init-file</param-name>
> <param-value>WEB-INF/Log.cfg</param-value>
> </init-param>
>
> <load-on-startup>1</load-on-startup>
> </servlet>
> [...]
>
>
> /webapp1/WEB-INF/Log.cfg
> ------------------------
> log4j.rootLogger=3Derror, stdout
>
> log4j.appender.stdout=3Dorg.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=3Dorg.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=3D[%p] %d{DATE}
> (webapp1:%c.%M():%L) "%m"%n
>
>
> webapp1 classes and JSP:
> ------------------------
> [...]
> private static Logger logger =3D Logger.getLogger("MyClass");
> [...]
> logger.debug("test");
> [...]
>
>
> The same for webapp2, except for its Log.cfg which contains the
> [%p] %d{DATE} (webapp2:%c.%M():%L) "%m"%n
> pattern.
>
> I see only "webapp2" in catalina.out, even for webapp1 classes.
> Any help would be appreciated.
>
> --
> Julien ALLANOS
> Silicomp-AQL
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]