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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to