You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brian McGovern <bm...@imediainc.com> on 2005/02/16 19:23:48 UTC

log4j best practices

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

Re: log4j best practices

Posted by lu...@lukeshannon.com.
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org