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: Logging from shared components
Date Wed, 28 Aug 2002 06:44:33 GMT

You can't do this in log4j 1.2 but in future versions.

At 22:48 27.08.2002 -0500, you wrote:
>Hi all...
>
>I'm a newbie to this list, so apologies up front if this question has been
>asked and answered before.  Here's a logging scenario that I'd like to
>configure, but can't seem to find the magic to do so.  Hoping some of you
>here might help...
>
>Let's say I have Servlet A and Servlet B deployed in some servlet container.
>Each servlet's init() method configures log4j and appends a
>RollingFileAppender with its own unique filename.  The desire here is that
>each servlet is a separate application and therefore has its own "trace"
>logfile.
>
>Now, let's say we've got some jar file that has a class named Foo.  Foo has
>a method called doSomething().  The class might look something like...
>
>public class Foo {
>     private static Logger logger = Logger.getInstance("my.foo");
>
>     public void doSomething() {
>         logger.debug("You've invoked me!");
>     }
>}
>
>
>Now, let's say that each servlet's doPost() method creates an instance of
>Foo and invokes it's doSomething() method.  What I find happening is that a
>POST to either servlet results in debug log event thrown from the shared
>component being written to both servlet's log file.
>
>How can I configure log4j so that logging events in the shared component
>resulting from a POSTs to Servlet A are only written to Servlet A's log
>file, and logging events in the shared component resulting from a POSTs to
>Servlet B are only written to Servlet B's log file?
>
>Thanks for the help...
>
>Timothy
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

--
Ceki


--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message