You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Mike McCown <MM...@securitybroadband.com> on 2003/07/25 15:52:21 UTC

log4j fighting with commons-logging in Tomcat 4.1.24

I just started using Tomcat 4.1 (moving from another server). My apps
were all coded to use the Log4j logger (1.2.8). Here's my problem.

When starting up, Tomcat apparently uses commons-logging.jar (actually,
it first uses commons-logging-api.jar??). It creates a default console
appender for my loggers in a format I hate ("milliseconds-since-start
[Thread-x] LEVEL category - text"). Now, my log4j.properties file, which
I've put into the $CATALINA_HOME/common/classes directory, also sets up
a console appender (in a format I like). Both of these appenders now
write to the console, so I get 2 lines for each logger entry.

Question: How the heck do I get rid of (or change the format of) the
default console appender that Tomcat creates??  I know I can write some
initialization servlet to get all the loggers from the root and remove
the appender, but I'd really like to do this via properties or xml
config files. What I'd really like is an understanding of where the
original logger's console appender is being created in the standard
Tomcat 4.1.24 install.

(I've searched the FAQs, RTFM'd, and moved properties and jar files all
over the place, but I *cannot* figure this out!!)

Mike




The information in this email may be confidential and/or privileged.  This
email is intended to be reviewed by only the individual(s) or
organization(s) named above.  If you are not an intended recipient, then
any review, dissemination or copying of this email, any attachments or any
information contained herein is prohibited.  If you have received this
email in error, please immediately notify the sender by return email and
delete this email from your system.       This email and any attachments
are not intended to constitute an offer or acceptance and do not create or
evidence a contract or any amendment to a contract between Security
Broadband and the intended recipient(s) or any other party.  This email
and any attachments may not be relied on by anyone as the basis of a
contract.  By sending this email, the sender does not consent to conduct
(by electronic means) any transactions that may be the subject of this
email.  Any such consent must be separately and expressly obtained in
writing manually executed by an authorized representative of Security
Broadband.


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


Re: log4j fighting with commons-logging in Tomcat 4.1.24

Posted by Nathan Coast <na...@codeczar.com>.
If the log4j classes aren't available to the servlet container then 
tomcat will use jdk1.4 logging for its logging (or some commons-logging 
default implementation if not available).  If you then only make log4j 
available to your webapps (place the jar in WEB-INF/lib) then logging 
will only be configured by your web-app, ie place your propertis in 
WEB-INF/classes/log4j.properties

hope this helps

Mike McCown wrote:

> I just started using Tomcat 4.1 (moving from another server). My apps
> were all coded to use the Log4j logger (1.2.8). Here's my problem.
> 
> When starting up, Tomcat apparently uses commons-logging.jar (actually,
> it first uses commons-logging-api.jar??). It creates a default console
> appender for my loggers in a format I hate ("milliseconds-since-start
> [Thread-x] LEVEL category - text"). Now, my log4j.properties file, which
> I've put into the $CATALINA_HOME/common/classes directory, also sets up
> a console appender (in a format I like). Both of these appenders now
> write to the console, so I get 2 lines for each logger entry.
> 
> Question: How the heck do I get rid of (or change the format of) the
> default console appender that Tomcat creates??  I know I can write some
> initialization servlet to get all the loggers from the root and remove
> the appender, but I'd really like to do this via properties or xml
> config files. What I'd really like is an understanding of where the
> original logger's console appender is being created in the standard
> Tomcat 4.1.24 install.
> 
> (I've searched the FAQs, RTFM'd, and moved properties and jar files all
> over the place, but I *cannot* figure this out!!)
> 
> Mike
> 
> 
> 
> 
> The information in this email may be confidential and/or privileged.  This
> email is intended to be reviewed by only the individual(s) or
> organization(s) named above.  If you are not an intended recipient, then
> any review, dissemination or copying of this email, any attachments or any
> information contained herein is prohibited.  If you have received this
> email in error, please immediately notify the sender by return email and
> delete this email from your system.       This email and any attachments
> are not intended to constitute an offer or acceptance and do not create or
> evidence a contract or any amendment to a contract between Security
> Broadband and the intended recipient(s) or any other party.  This email
> and any attachments may not be relied on by anyone as the basis of a
> contract.  By sending this email, the sender does not consent to conduct
> (by electronic means) any transactions that may be the subject of this
> email.  Any such consent must be separately and expressly obtained in
> writing manually executed by an authorized representative of Security
> Broadband.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> 


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