logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: tomcat and log4j, again
Date Thu, 03 Jul 2003 17:07:18 GMT


>I am not explicitly initializing log4j. A class that I am using
>in my app invokes logging as follows:
>package fermataintl.migrasponder.common;
>import java.sql.*;
>import org.apache.log4j.*;
>public class Vendor
>     logger.warn("attempt to authenticate '" + id + "' failed");
>     private static Logger logger = Logger.getLogger(Vendor.class);

The above can't compile: did you copy and paste it wrong?

>1571947 [Thread-5] WARN common.Vendor  - attempt to authenticate 'xxx'

Looks like the default layout, not the one you specified.

>So... my questions are:
>1) How do I get output to a file of my own choosing
>2) How do I get the formatting to come out with date and time

Use a FileAppender or one of its variants.  Specify the File attribute
such that it points to a writable directory/file.  Specify the Layout
for this FileAppender just like you did for the ConsoleAppender.  I
don't know why the layout for your console appender wasn't picked up,
since you've already said you don't see any errors ever in your logs
even with log4j.debug=true.

Yoav Shapira

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: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org

View raw message