logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hurt <johnh...@gmail.com>
Subject How to use Log4J in Multiple classes? App Design?
Date Tue, 12 Jul 2005 23:57:43 GMT
Hi,

My application is split up into multiple classes. If I had processing in 
each class that I wanted to log, what's the best way to make a reference to 
the Logger available, so that for instance they all write to the same log 
file?

Do I create an instance of the Logger class at the beginning of the program 
flow, then pass that class to all the methods/classes that plan to do 
logging?

Do I make a wrapper singleton class that has a Logger in it and all code 
refers to the wrapper class?

Do I use a base class (or interface or abstract class) that includes a 
reference to a Logger class?

Anyone has generic examples where Logger is used in more than 1 class, how 
to use it gracefully? Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message