I believe the classes have to be compiled with debug info included. If using ant, javac would be done with the debug="true" attribute.

See further info on ant's javac task here:

http://ant.apache.org/manual/CoreTasks/javac.html

--David

Brian McGovern wrote:

Im not able to get the class name and line number spittin out in the logs for 
classes where i call the logger.  But for jakarta, and struts classes I am.  
What am i doing wrong.

In Class Named DBConnection:
--private static final Logger zLogger = 
Logger.getLogger(DBConnection.class.getName());

log4j.properties file snippet:
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

The corresponding log:
ERROR [http-8080-Processor25] (?:?) - 
org.apache.commons.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory ([Microsoft][SQLServer 2000 Driver

Where did i go wrong?


-----Original Message----- From: Brian McGovern [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 16, 2005 4:57 PM To: Tomcat Users List Subject: RE: log4j best practices


Oh man. they were in winnt system32 the whole time. UGH. You were right. Thanks Jake!

-----Original Message-----
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 16, 2005 4:28 PM
To: Tomcat Users List
Subject: RE: log4j best practices


Since you define your log files relatively, they will end up relative to the directory where the JVM was started from. I you use Tomcat scripts, then it will be in CATALINA_HOME/bin. If you use the Tomcat service, then the files will end up in c:\winnt\System32 (unless you changed the base directory from which the service starts the JVM.

I suggest you use...

log4j.appender.stdout.File=${catalina.home}/logs/catalina.out


Tomcat creates the "catalina.home" system property at startup. You can use it to reference Tomcat's home directory and then put the file anywhere you want relative to that.


Jake

Quoting Brian McGovern <[EMAIL PROTECTED]>:



Thats the same approach im using. I have a commons-logging.properties and a
log4j.properties file in my WEB-INF\classes directory.  But I only get the
same loggin as before in stdout.log  Im using Win2k as OS.  Where do my
defined log files go?  Im confused.  Everything compiles.

I have this line in my classes:
--------------------------------------------------------
private static final Logger zLogger = Logger.getLogger("MYCLASSNAME.CLASS");

Logging like this:
--------------------------------------------------------
zLogger.debug("New Session Was Created");


commons-logging.properties file has 1 line. -------------------------------------------------------- org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

log4j.properties file is here:
--------------------------------------------------------
log4j.rootLogger=DEBUG, stdout, nycbbuilder_log
log4j.appender.stdout=org.apache.log4j.RollingFileAppender
log4j.appender.stdout.File=catalina.out
log4j.appender.stdout.MaxFileSize=100KB
log4j.appender.stdout.MaxBackupIndex=2
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.appender.nycbbuilder_log=org.apache.log4j.RollingFileAppender
log4j.appender.nycbbuilder_log.File=nycbbuilder.log
log4j.appender.nycbbuilder_log.MaxFileSize=100KB
log4j.appender.nycbbuilder_log.MaxBackupIndex=2
log4j.appender.nycbbuilder_log.layout=org.apache.log4j.PatternLayout
log4j.appender.nycbbuilder_log.layout.ConversionPattern=%d{ABSOLUTE} - %p %c
- %m%n



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 16, 2005 1:52 PM
To: Tomcat Users List
Subject: Re: log4j best practices


I just implemented this over the weekend.

Still not totally sure what I am doing, but I do have all my classes
outputting to a log file I have specified.  I went with a simple approach
creating a reference to a Logger object in each class (I have an external
properties file supplying all the config options). My problem is
everything ends up in one giant file and it is hard to interpret.

I am now thinking about having each class create and configure a logger
object and write to its own file. One log per class.

The good thing is it is log4j is easy to set up and start logging with.

Here is the tutorial I got started with:

http://www.developer.com/open/article.php/10930_3097221_1

HTH

Luke




Hi everyone
Im looking for some tips on implementing a logging system in tomcat.  Ive
got log4j installed and am about to write code but im just looking for
some tips before i get started.  My idea is to write a central logger
class for my app that imports the log4j package and supplys static methods
to my app but I don't know if thats a bad idea?

thanks
-B




--------------------------------------------------------------------- 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]







---------------------------------------------------------------------
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]


--------------------------------------------------------------------- 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]



Reply via email to