Logging from shared components

2002-08-27 Thread Timothy Bennett

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:   
For additional commands, e-mail: 




Re: Logging from shared components

2002-08-27 Thread Ceki Gülcü


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:   
>For additional commands, e-mail: 

--
Ceki


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Logging from shared components

2002-08-28 Thread Timothy Bennett

Ok... fair enough... I'll wait for a future version then...

In the meantime, if I log all servlets to the same log, is there a way I
could write the events from each servlet so that I could filter the log when
I view it to only see events from one specific servlet?

- Original Message -
From: "Ceki Gülcü" <[EMAIL PROTECTED]>
To: "Log4J Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, August 28, 2002 1:44 AM
Subject: Re: Logging from shared components


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



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>