Re: log4j and tomcat 5.5

2004-12-09 Thread Jacob Kjome

Are you trying to enable logging for Tomcat, your webapp, or both?  You will
need to add both log4j.jar and commons-logging.jar (not
commons-logging-api.jar) to common/lib to enable Log4j logging for Tomcat-5.5.x
itself.  For your own app, do you use actually use the commons-logging api or
just the Log4j api?  If the latter, don't bother with commons-logging.  In
fact, try to avoid it like the plague.  If you do require commons-logging for
your webapp logging, I'm not entirely sure whether it is ok to have log4j.jar
in WEB-INF/lib and commons-logging.jar in common/lib or if they have to be
together.  There could be classloader issues if you separate them.  I'm not
really sure.  commons-logging issus are outside the scope of my knowledge.


Jake

Quoting Marcelo Moreira <[EMAIL PROTECTED]>:

> Hello,
>
> This is sure a newbie question, but I have been having a lot of
> trouble trying to get logging to work on tomcat 5.5 with log4j.
>
> I got everything working (I think...) but I have been wondering about
> something...
>
> Would anybody know why I still have to put a copy of
> commons-logging.jar + log4j.jar into the webapp WEB-INF/lib directory
> for logging to work for the webapp, even though it is already in
> common/lib (so it should be shared by all classes, including webapps,
> right...) ?
>
> Thanks,
> Marcelo.
>
> -
> 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: log4j and tomcat 5.5

2004-12-09 Thread Marcelo Moreira
On Thu,  9 Dec 2004 16:33:33 -0600, Jacob Kjome <[EMAIL PROTECTED]> wrote:
> Are you trying to enable logging for Tomcat, your webapp, or both?  You will
> need to add both log4j.jar and commons-logging.jar (not
> commons-logging-api.jar) to common/lib to enable Log4j logging for 
> Tomcat-5.5.x
> itself.  For your own app, do you use actually use the commons-logging api or
> just the Log4j api?  If the latter, don't bother with commons-logging.  In
> fact, try to avoid it like the plague.  If you do require commons-logging for
> your webapp logging, I'm not entirely sure whether it is ok to have log4j.jar
> in WEB-INF/lib and commons-logging.jar in common/lib or if they have to be
> together.  There could be classloader issues if you separate them.  I'm not
> really sure.  commons-logging issus are outside the scope of my knowledge.

Thanks for the answer. I am trying for both. commons-logging.jar +
log4j.jar are in commons/lib. But here is the question: I do not see
why they also have to be on the webapp WEB-INF/lib, since it should be
shared because they are already on commons/lib.

If I do not put them in the webapp WEB-INF/lib, logging for the webapp
does not work.

As I said, I got it working already, but this is just curiosity.

Thanks,
Marcelo.

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



Re: log4j and tomcat 5.5

2004-12-09 Thread Jacob Kjome
Quoting Marcelo Moreira <[EMAIL PROTECTED]>:

> On Thu,  9 Dec 2004 16:33:33 -0600, Jacob Kjome <[EMAIL PROTECTED]> wrote:
> > Are you trying to enable logging for Tomcat, your webapp, or both?  You
> will
> > need to add both log4j.jar and commons-logging.jar (not
> > commons-logging-api.jar) to common/lib to enable Log4j logging for
> Tomcat-5.5.x
> > itself.  For your own app, do you use actually use the commons-logging api
> or
> > just the Log4j api?  If the latter, don't bother with commons-logging.  In
> > fact, try to avoid it like the plague.  If you do require commons-logging
> for
> > your webapp logging, I'm not entirely sure whether it is ok to have
> log4j.jar
> > in WEB-INF/lib and commons-logging.jar in common/lib or if they have to be
> > together.  There could be classloader issues if you separate them.  I'm not
> > really sure.  commons-logging issus are outside the scope of my knowledge.
>
> Thanks for the answer. I am trying for both. commons-logging.jar +
> log4j.jar are in commons/lib. But here is the question: I do not see
> why they also have to be on the webapp WEB-INF/lib, since it should be
> shared because they are already on commons/lib.
>

If you share the common/lib instance of Log4j with your webapp, you will be
using the same logger repository as the application server.  There is one
configuration per logger repository.  If force reconfiguration within this
already configured logger repository, your old configuration will be blown
away.

The idea Putting another copy of Log4j.jar in WEB-INF/lib in addition to the one
in common/lib is to take advantage of Tomcat's classloading behavior which is
child first (recommended by the servlet spec) rather than parent first (normal
Java2 classloading behavior).  Because each webapp looks locally for libraries
first, it will find an instance of Log4j that is not in use by any other
application.  Therefore, the default logger repository will be distinct from
that of the server and from that of any other webapp.  You can configure to
your hearts content without stompting on others' logging configuration.

There is a way to separate application logging while sharing the same instance
of Log4j and that is by using a repository selector.  I would avoid this until
Log4j-1.3 is released.  It is more difficult to use a repository selector in
Log4j-1.2.  1.3 makes it very simple.  I recommend you use the first solution
until Log4j-1.3 is released.

> If I do not put them in the webapp WEB-INF/lib, logging for the webapp
> does not work.
>

You are counting on autoconfiguration here.  If you have an instance in
common/lib, but not one in WEB-INF/lib, the logger repository of the one in
common/lib will already have been configured by the time your app is
initialized.  Autoconfiguration is not performed more than once.  Your webapp,
in this case, will be using the configuration of the config file at the server
level (in common/classes).  Again, with a repository selector, your app config
could be separated from the default logger repository.  Note that in Log4j-1.3
you will need to perform configuration as there is no autoconfiguration, at
least via classloader discovery of config files, on non-default logger
repositories.

> As I said, I got it working already, but this is just curiosity.
>

Hopefully I explained things better and piqued your curiosity about repostiory
selectors in Log4j-1.3 :-)


Jake

> Thanks,
> Marcelo.
>
> -
> 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: log4j and tomcat 5.5

2004-12-12 Thread Dale, Matt
> Hopefully I explained things better and piqued your curiosity about repostiory
> selectors in Log4j-1.3 :-)

You certainly have mine ;)

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Friday, December 10, 2004 12:06 AM
To: Tomcat Users List; Marcelo Moreira
Subject: Re: log4j and tomcat 5.5


Quoting Marcelo Moreira <[EMAIL PROTECTED]>:

> On Thu,  9 Dec 2004 16:33:33 -0600, Jacob Kjome <[EMAIL PROTECTED]> wrote:
> > Are you trying to enable logging for Tomcat, your webapp, or both?  You
> will
> > need to add both log4j.jar and commons-logging.jar (not
> > commons-logging-api.jar) to common/lib to enable Log4j logging for
> Tomcat-5.5.x
> > itself.  For your own app, do you use actually use the commons-logging api
> or
> > just the Log4j api?  If the latter, don't bother with commons-logging.  In
> > fact, try to avoid it like the plague.  If you do require commons-logging
> for
> > your webapp logging, I'm not entirely sure whether it is ok to have
> log4j.jar
> > in WEB-INF/lib and commons-logging.jar in common/lib or if they have to be
> > together.  There could be classloader issues if you separate them.  I'm not
> > really sure.  commons-logging issus are outside the scope of my knowledge.
>
> Thanks for the answer. I am trying for both. commons-logging.jar +
> log4j.jar are in commons/lib. But here is the question: I do not see
> why they also have to be on the webapp WEB-INF/lib, since it should be
> shared because they are already on commons/lib.
>

If you share the common/lib instance of Log4j with your webapp, you will be
using the same logger repository as the application server.  There is one
configuration per logger repository.  If force reconfiguration within this
already configured logger repository, your old configuration will be blown
away.

The idea Putting another copy of Log4j.jar in WEB-INF/lib in addition to the one
in common/lib is to take advantage of Tomcat's classloading behavior which is
child first (recommended by the servlet spec) rather than parent first (normal
Java2 classloading behavior).  Because each webapp looks locally for libraries
first, it will find an instance of Log4j that is not in use by any other
application.  Therefore, the default logger repository will be distinct from
that of the server and from that of any other webapp.  You can configure to
your hearts content without stompting on others' logging configuration.

There is a way to separate application logging while sharing the same instance
of Log4j and that is by using a repository selector.  I would avoid this until
Log4j-1.3 is released.  It is more difficult to use a repository selector in
Log4j-1.2.  1.3 makes it very simple.  I recommend you use the first solution
until Log4j-1.3 is released.

> If I do not put them in the webapp WEB-INF/lib, logging for the webapp
> does not work.
>

You are counting on autoconfiguration here.  If you have an instance in
common/lib, but not one in WEB-INF/lib, the logger repository of the one in
common/lib will already have been configured by the time your app is
initialized.  Autoconfiguration is not performed more than once.  Your webapp,
in this case, will be using the configuration of the config file at the server
level (in common/classes).  Again, with a repository selector, your app config
could be separated from the default logger repository.  Note that in Log4j-1.3
you will need to perform configuration as there is no autoconfiguration, at
least via classloader discovery of config files, on non-default logger
repositories.

> As I said, I got it working already, but this is just curiosity.
>

Hopefully I explained things better and piqued your curiosity about repostiory
selectors in Log4j-1.3 :-)


Jake

> Thanks,
> Marcelo.
>
> -
> 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]

Any opinions expressed in this E-mail may be those of the individual and not 
necessarily the company. This E-mail and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivering to the intended 
recipient, be advised that you have received this E-mail in error and that any 
use or copying is strictly prohibited. If you have received this E-mail in 
error please notify the beCogent postmaster at [EMAIL PROTECTED]
Unless expressly stated, opinions in this email are those of the individual 
sender and not beCogent Ltd. You must take full responsibility for virus 
checking this email an

RE: log4j and tomcat 5.5

2004-12-13 Thread Shapira, Yoav

Hi,

>-Original Message-
>From: Dale, Matt [mailto:[EMAIL PROTECTED]
>Sent: Sunday, December 12, 2004 5:22 PM
>To: Tomcat Users List
>Subject: RE: log4j and tomcat 5.5
>
>> Hopefully I explained things better and piqued your curiosity about
>repostiory
>> selectors in Log4j-1.3 :-)
>
>You certainly have mine ;)



Log4j 1.3 is in an alpha state right now, and its only testers appear to
be its committers.  It'd be useful to have someone who knows what he's
doing, but is not a log4j committer, like you, test it as well.  ;)



Yoav Shapira http://www.yoavshapira.com





This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, proprietary 
and/or privileged.  This e-mail is intended only for the individual(s) to whom 
it is addressed, and may not be saved, copied, printed, disclosed or used by 
anyone else.  If you are not the(an) intended recipient, please immediately 
delete this e-mail from your computer system and notify the sender.  Thank you.


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



RE: log4j and tomcat 5.5

2004-12-13 Thread Dale, Matt
Hi,

Shameless plug accepted, is there somewhere I can download it or do I need to 
get it from CVS?

Ta
Matt

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: 13 December 2004 14:02
To: Tomcat Users List
Subject: RE: log4j and tomcat 5.5



Hi,

>-Original Message-
>From: Dale, Matt [mailto:[EMAIL PROTECTED]
>Sent: Sunday, December 12, 2004 5:22 PM
>To: Tomcat Users List
>Subject: RE: log4j and tomcat 5.5
>
>> Hopefully I explained things better and piqued your curiosity about
>repostiory
>> selectors in Log4j-1.3 :-)
>
>You certainly have mine ;)



Log4j 1.3 is in an alpha state right now, and its only testers appear to
be its committers.  It'd be useful to have someone who knows what he's
doing, but is not a log4j committer, like you, test it as well.  ;)



Yoav Shapira http://www.yoavshapira.com





This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, proprietary 
and/or privileged.  This e-mail is intended only for the individual(s) to whom 
it is addressed, and may not be saved, copied, printed, disclosed or used by 
anyone else.  If you are not the(an) intended recipient, please immediately 
delete this e-mail from your computer system and notify the sender.  Thank you.


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

Any opinions expressed in this E-mail may be those of the individual and not 
necessarily the company. This E-mail and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivering to the intended 
recipient, be advised that you have received this E-mail in error and that any 
use or copying is strictly prohibited. If you have received this E-mail in 
error please notify the beCogent postmaster at [EMAIL PROTECTED]
Unless expressly stated, opinions in this email are those of the individual 
sender and not beCogent Ltd. You must take full responsibility for virus 
checking this email and any attachments.
Please note that the content of this email or any of its attachments may 
contain data that falls within the scope of the Data Protection Acts and that 
you must ensure that any handling or processing of such data by you is fully 
compliant with the terms and provisions of the Data Protection Act 1984 and 
1998.


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

RE: log4j and tomcat 5.5

2004-12-13 Thread Shapira, Yoav

Hi,

>Shameless plug accepted, is there somewhere I can download it or do I
need
>to get it from CVS?

The download page: http://logging.apache.org/site/binindex.html.

Yoav Shapira http://www.yoavshapira.com




This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, proprietary 
and/or privileged.  This e-mail is intended only for the individual(s) to whom 
it is addressed, and may not be saved, copied, printed, disclosed or used by 
anyone else.  If you are not the(an) intended recipient, please immediately 
delete this e-mail from your computer system and notify the sender.  Thank you.


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



RE: log4j and tomcat 5.5

2004-12-13 Thread Dale, Matt
ignore that, found the binary download.

Ta
Matt

-Original Message-
From: Dale, Matt 
Sent: 13 December 2004 14:37
To: Tomcat Users List
Subject: RE: log4j and tomcat 5.5


Hi,

Shameless plug accepted, is there somewhere I can download it or do I need to 
get it from CVS?

Ta
Matt

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: 13 December 2004 14:02
To: Tomcat Users List
Subject: RE: log4j and tomcat 5.5



Hi,

>-Original Message-
>From: Dale, Matt [mailto:[EMAIL PROTECTED]
>Sent: Sunday, December 12, 2004 5:22 PM
>To: Tomcat Users List
>Subject: RE: log4j and tomcat 5.5
>
>> Hopefully I explained things better and piqued your curiosity about
>repostiory
>> selectors in Log4j-1.3 :-)
>
>You certainly have mine ;)



Log4j 1.3 is in an alpha state right now, and its only testers appear to
be its committers.  It'd be useful to have someone who knows what he's
doing, but is not a log4j committer, like you, test it as well.  ;)



Yoav Shapira http://www.yoavshapira.com





This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, proprietary 
and/or privileged.  This e-mail is intended only for the individual(s) to whom 
it is addressed, and may not be saved, copied, printed, disclosed or used by 
anyone else.  If you are not the(an) intended recipient, please immediately 
delete this e-mail from your computer system and notify the sender.  Thank you.


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

Any opinions expressed in this E-mail may be those of the individual and not 
necessarily the company. This E-mail and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivering to the intended 
recipient, be advised that you have received this E-mail in error and that any 
use or copying is strictly prohibited. If you have received this E-mail in 
error please notify the beCogent postmaster at [EMAIL PROTECTED]
Unless expressly stated, opinions in this email are those of the individual 
sender and not beCogent Ltd. You must take full responsibility for virus 
checking this email and any attachments.
Please note that the content of this email or any of its attachments may 
contain data that falls within the scope of the Data Protection Acts and that 
you must ensure that any handling or processing of such data by you is fully 
compliant with the terms and provisions of the Data Protection Act 1984 and 
1998.


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

Re: log4j and tomcat 5.5

2004-12-16 Thread Steven J. Owens

On Thu, Dec 09, 2004 at 04:33:33PM -0600, Jacob Kjome wrote:
> For your own app, do you use actually use the commons-logging api or
> just the Log4j api?  If the latter, don't bother with
> commons-logging.  In fact, try to avoid it like the plague.

 Could you expand on this?  I've wondered in the past about this
very question (whether I should code my app to use commons-logging for
logging, or directly use log4j) and I'm interested in hearing what the
downsides are.

 I've said it before, I'll say it again, I wish there was some
sort of "tomcat production hosting best practices" repository.  Maybe
a wiki page or something.  Or maybe I'll just invite people to send me
suggestions for such a page.

-- 
Steven J. Owens
[EMAIL PROTECTED]

"I'm going to make broad, sweeping generalizations and strong,
 declarative statements, because otherwise I'll be here all night and
 this document will be four times longer and much less fun to read.
 Take it all with a grain of salt." - http://darksleep.com/notablog


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



Re: log4j and tomcat 5.5

2004-12-16 Thread Jacob Kjome
At 03:17 PM 12/16/2004 -0500, you wrote:
>
>On Thu, Dec 09, 2004 at 04:33:33PM -0600, Jacob Kjome wrote:
>> For your own app, do you use actually use the commons-logging api or
>> just the Log4j api?  If the latter, don't bother with
>> commons-logging.  In fact, try to avoid it like the plague.
>
> Could you expand on this?  I've wondered in the past about this
>very question (whether I should code my app to use commons-logging for
>logging, or directly use log4j) and I'm interested in hearing what the
>downsides are.
>
This has been covered many times.  Here are some good references...
http://marc.theaimsgroup.com/?l=log4j-user&m=102640868804904
http://marc.theaimsgroup.com/?l=log4j-user&m=103864746403401&w=2
http://www.qos.ch/logging/thinkAgain.jsp
Commons Logging was my fault
http://radio.weblogs.com/0122027/2003/08/15.html
> I've said it before, I'll say it again, I wish there was some
>sort of "tomcat production hosting best practices" repository.  Maybe
>a wiki page or something.  Or maybe I'll just invite people to send me
>suggestions for such a page.
>
Try the docs or the apache wiki
http://wiki.apache.org/jakarta-tomcat/FrontPage
Jake
>--
>Steven J. Owens
>[EMAIL PROTECTED]
>
>"I'm going to make broad, sweeping generalizations and strong,
> declarative statements, because otherwise I'll be here all night and
> this document will be four times longer and much less fun to read.
> Take it all with a grain of salt." - http://darksleep.com/notablog
>
>
>-
>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]