RE: Different log files for different web applications under Tomcat

2006-02-28 Thread julie gautier
Thanks to all of you.
  It works fine.

Jacob Kjome <[EMAIL PROTECTED]> a écrit :
  
see comment below...

At 06:05 PM 2/27/2006 +0100, you wrote:
>Interesting aspect. I never dealt with classloaders. Thanks for this
>improvement of my knowledge.
>
>Heri
>
>> -Original Message-
>> From: Javier Gonzalez [mailto:[EMAIL PROTECTED]
>> Sent: Monday, February 27, 2006 5:31 PM
>> To: Log4J Users List
>> Subject: Re: Different log files for different web applications under
>> Tomcat
>>
>>
>> It does not start different JVMs - however, given the way the tomcat
>> classloader works (
>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html ), the
>> instances are separate. I have a bunch of servers with separate log4j
>> configurations on each context to support my point ;)
>>
>> But you made me remember an important point - log4j.jar must
>> be only inside
>> the contexts, and not in $TOMCAT_HOME/common/lib or
>> $TOMCAT_HOME/shared/lib
>>

No, it's perfectly fine to have log4j.jar in either common/lib or 
shared/lib *and* have log4j.jar in each webapp's WEB-INF/lib. Logging will 
still be separated. The global log4j.jar will be used for Tomcat logging 
(assuming you also have commons-logging.jar in common/lib and log4j.xml or 
log4j.properties in common/classes) or any application that doesn't include 
log4j.jar in WEB-INF/lib. Watch out for log4j.jar's in WEB-INF/lib looking 
up log4j.xml in common/classes when performing default configuration at 
classloader startup. To prevent this, put log4j.xml in 
WEB-INF/classes. If you want to perform manual configuration at a later 
time than classloader startup, make the log4j.xml file a dummy file that 
has all logging turned off. "log4j.xml" is significant, since Log4j looks 
for it in preference to log4j.properties.

Of course, the other option is to use a repository selector such as the 
ContextJNDISelector in Log4j-1.3 or the 1.2 compatible version in the sandbox.

Jake

>> On 2/27/06, Bender Heri wrote:
>> >
>> > Does Tomcat start a separate JVM for each WEB-INF
>> application? If not,
>> > your suggestion would not work since Log4j is global within one JVM.
>> > Heri
>> >
>
>-
>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]




-
 Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs 
exceptionnels pour appeler la France et l'international.Téléchargez la version 
beta.

RE: Different log files for different web applications under Tomcat

2006-02-27 Thread Jacob Kjome


see comment below...

At 06:05 PM 2/27/2006 +0100, you wrote:
>Interesting aspect. I never dealt with classloaders. Thanks for this
>improvement of my knowledge.
>
>Heri
>
>> -Original Message-
>> From: Javier Gonzalez [mailto:[EMAIL PROTECTED]
>> Sent: Monday, February 27, 2006 5:31 PM
>> To: Log4J Users List
>> Subject: Re: Different log files for different web applications under
>> Tomcat
>>
>>
>> It does not start different JVMs - however, given the way the tomcat
>> classloader works (
>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html ), the
>> instances are separate. I have a bunch of servers with separate log4j
>> configurations on each context to support my point ;)
>>
>> But you made me remember an important point - log4j.jar must
>> be only inside
>> the contexts, and not in $TOMCAT_HOME/common/lib or
>> $TOMCAT_HOME/shared/lib
>>

No, it's perfectly fine to have log4j.jar in either common/lib or 
shared/lib *and* have log4j.jar in each webapp's WEB-INF/lib.  Logging will 
still be separated.  The global log4j.jar will be used for Tomcat logging 
(assuming you also have commons-logging.jar in common/lib and log4j.xml or 
log4j.properties in common/classes) or any application that doesn't include 
log4j.jar in WEB-INF/lib.  Watch out for log4j.jar's in WEB-INF/lib looking 
up log4j.xml in common/classes when performing default configuration at 
classloader startup.  To prevent this, put log4j.xml in 
WEB-INF/classes.  If you want to perform manual configuration at a later 
time than classloader startup, make the log4j.xml file a dummy file that 
has all logging turned off.  "log4j.xml" is significant, since Log4j looks 
for it in preference to log4j.properties.


Of course, the other option is to use a repository selector such as the 
ContextJNDISelector in Log4j-1.3 or the 1.2 compatible version in the sandbox.


Jake

>> On 2/27/06, Bender Heri <[EMAIL PROTECTED]> wrote:
>> >
>> > Does Tomcat start a separate JVM for each WEB-INF
>> application? If not,
>> > your suggestion would not work since Log4j is global within one JVM.
>> > Heri
>> >
>
>-
>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]



RE: Different log files for different web applications under Tomcat

2006-02-27 Thread Bender Heri
Interesting aspect. I never dealt with classloaders. Thanks for this 
improvement of my knowledge.

Heri

> -Original Message-
> From: Javier Gonzalez [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 27, 2006 5:31 PM
> To: Log4J Users List
> Subject: Re: Different log files for different web applications under
> Tomcat
> 
> 
> It does not start different JVMs - however, given the way the tomcat
> classloader works (
> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html ), the
> instances are separate. I have a bunch of servers with separate log4j
> configurations on each context to support my point ;)
> 
> But you made me remember an important point - log4j.jar must 
> be only inside
> the contexts, and not in $TOMCAT_HOME/common/lib or 
> $TOMCAT_HOME/shared/lib
> 
> On 2/27/06, Bender Heri <[EMAIL PROTECTED]> wrote:
> >
> > Does Tomcat start a separate JVM for each WEB-INF 
> application? If not,
> > your suggestion would not work since Log4j is global within one JVM.
> > Heri
> >

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



Re: Different log files for different web applications under Tomcat

2006-02-27 Thread Javier Gonzalez
It does not start different JVMs - however, given the way the tomcat
classloader works (
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html ), the
instances are separate. I have a bunch of servers with separate log4j
configurations on each context to support my point ;)

But you made me remember an important point - log4j.jar must be only inside
the contexts, and not in $TOMCAT_HOME/common/lib or $TOMCAT_HOME/shared/lib

On 2/27/06, Bender Heri <[EMAIL PROTECTED]> wrote:
>
> Does Tomcat start a separate JVM for each WEB-INF application? If not,
> your suggestion would not work since Log4j is global within one JVM.
> Heri
>
> > -Original Message-
> > From: Javier Gonzalez [mailto:[EMAIL PROTECTED]
> > Sent: Monday, February 27, 2006 4:47 PM
> > To: Log4J Users List
> > Subject: Re: Different log files for different web applications under
> > Tomcat
> >
> >
> > Easiest way: include a copy of log4j.jar in each of the web apps'
> > WEB-INF/lib folder. Include a separate log4j configuration
> > file in each
> > WEB-INF/classes (or modify each app to configure log4j in each).
> >
> > On 2/27/06, julie gautier <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi all,
> > >   I use Tomcat to deploy two web applications. Actually,
> > all the traces
> > > are written to a single file (stdout.log) under the Tomcat
> > log directory.
> > > How can I do to write the traces to different log files :
> > app1.out and
> > > app2.out for instance.
> > >   Could you please send me an example ?
> > >   Thanks to help me.
> > >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Javier González Nicolini


RE: Different log files for different web applications under Tomcat

2006-02-27 Thread Bender Heri
Does Tomcat start a separate JVM for each WEB-INF application? If not, your 
suggestion would not work since Log4j is global within one JVM.
Heri

> -Original Message-
> From: Javier Gonzalez [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 27, 2006 4:47 PM
> To: Log4J Users List
> Subject: Re: Different log files for different web applications under
> Tomcat
> 
> 
> Easiest way: include a copy of log4j.jar in each of the web apps'
> WEB-INF/lib folder. Include a separate log4j configuration 
> file in each
> WEB-INF/classes (or modify each app to configure log4j in each).
> 
> On 2/27/06, julie gautier <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >   I use Tomcat to deploy two web applications. Actually, 
> all the traces
> > are written to a single file (stdout.log) under the Tomcat 
> log directory.
> > How can I do to write the traces to different log files : 
> app1.out and
> > app2.out for instance.
> >   Could you please send me an example ?
> >   Thanks to help me.
> >

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



Re: Different log files for different web applications under Tomcat

2006-02-27 Thread Javier Gonzalez
The short log4j tutorial on the log4j website (
http://logging.apache.org/log4j/docs/manual.html ) should give you a quick
primer on configuring log4j for a specific log file.

On the issue at hand, having a copy of log4j in each tomcat context insures
that there are two independent stances of log4j, one in each context. You
just need to create a configuration file for each as if it was a standalone
app, and don't worry about the other.

On 2/27/06, julie gautier <[EMAIL PROTECTED]> wrote:
>
> I know my questions are probably stupid (I'm don't know anything to log4j)
> but I actually use log4j without configuration file. Do I have to have a
> lo4j.properties and a log4j.xml files ? Does someone have an example of
> such configuration files in the aim of having log files depending on the
> context (one per application) ?
>   Thanks again... and sorry for those (too simple and annoying) questions.
>
> Javier Gonzalez <[EMAIL PROTECTED]> a écrit :
>   Easiest way: include a copy of log4j.jar in each of the web apps'
> WEB-INF/lib folder. Include a separate log4j configuration file in each
> WEB-INF/classes (or modify each app to configure log4j in each).
>
> On 2/27/06, julie gautier wrote:
> >
> > Hi all,
> > I use Tomcat to deploy two web applications. Actually, all the traces
> > are written to a single file (stdout.log) under the Tomcat log
> directory.
> > How can I do to write the traces to different log files : app1.out and
> > app2.out for instance.
> > Could you please send me an example ?
> > Thanks to help me.
> >
> >
> >
> > -
> > Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> > tarifs exceptionnels pour appeler la France et l'
> international.Téléchargezla version beta.
> >
>
>
>
> --
> Javier González Nicolini
>
>
>
> -
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> tarifs exceptionnels pour appeler la France et l'international.Téléchargezla 
> version beta.
>



--
Javier González Nicolini


Re: Different log files for different web applications under Tomcat

2006-02-27 Thread julie gautier
I know my questions are probably stupid (I'm don't know anything to log4j) but 
I actually use log4j without configuration file. Do I have to have a 
lo4j.properties and a log4j.xml files ? Does someone have an example of such 
configuration files in the aim of having log files depending on the context 
(one per application) ?
  Thanks again... and sorry for those (too simple and annoying) questions.

Javier Gonzalez <[EMAIL PROTECTED]> a écrit :
  Easiest way: include a copy of log4j.jar in each of the web apps'
WEB-INF/lib folder. Include a separate log4j configuration file in each
WEB-INF/classes (or modify each app to configure log4j in each).

On 2/27/06, julie gautier wrote:
>
> Hi all,
> I use Tomcat to deploy two web applications. Actually, all the traces
> are written to a single file (stdout.log) under the Tomcat log directory.
> How can I do to write the traces to different log files : app1.out and
> app2.out for instance.
> Could you please send me an example ?
> Thanks to help me.
>
>
>
> -
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> tarifs exceptionnels pour appeler la France et l'international.Téléchargezla 
> version beta.
>



--
Javier González Nicolini



-
 Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs 
exceptionnels pour appeler la France et l'international.Téléchargez la version 
beta.

Re: Different log files for different web applications under Tomcat

2006-02-27 Thread Javier Gonzalez
Easiest way: include a copy of log4j.jar in each of the web apps'
WEB-INF/lib folder. Include a separate log4j configuration file in each
WEB-INF/classes (or modify each app to configure log4j in each).

On 2/27/06, julie gautier <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>   I use Tomcat to deploy two web applications. Actually, all the traces
> are written to a single file (stdout.log) under the Tomcat log directory.
> How can I do to write the traces to different log files : app1.out and
> app2.out for instance.
>   Could you please send me an example ?
>   Thanks to help me.
>
>
>
> -
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> tarifs exceptionnels pour appeler la France et l'international.Téléchargezla 
> version beta.
>



--
Javier González Nicolini


RE: Different log files for different web applications under Tomcat

2006-02-27 Thread Bender Heri
see actual thread "Single logfile per User and Day" and the thread from last 
week "Use different log files inside one program".

Heri

> -Original Message-
> From: julie gautier [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 27, 2006 4:37 PM
> To: log4j-user@logging.apache.org
> Subject: Different log files for different web applications 
> under Tomcat
> 
> 
> Hi all,
>   I use Tomcat to deploy two web applications. Actually, all 
> the traces are written to a single file (stdout.log) under 
> the Tomcat log directory. How can I do to write the traces to 
> different log files : app1.out and app2.out for instance.
>   Could you please send me an example ?
>   Thanks to help me.
>
> 
>   
> -
>  Nouveau : téléphonez moins cher avec Yahoo! Messenger ! 
> Découvez les tarifs exceptionnels pour appeler la France et 
> l'international.Téléchargez la version beta.
> 

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