I would use wrappers, if at all, only for app or module wide special loggers 
(like fatal error alerting etc.), and only 
- if there is a special need to do something with the log event which cannot be 
done using the log4j framework 
- if some special initializing of the involved appenders is needed which cannot 
be done through configuration.

For debugging purpose I would recommend to use it the usual way (each class has 
its private logger instance which is named after the fully qualified 
classname). 
Advantages:
- you keep the main benefit of log4j to finetune your log output depending on 
classes or packages per configuration without changing code. 
- you can reuse some basic classes in other apps without to have carry over 
your log wrapper. Applies also to unit testing which can be done without the 
need of initializing the wrapper framework.

Disadvantages of wrapper:
- wrapper instances have to be carried all along the callstack or must be 
accessible in a static way.
- Danger of unwanted dependencies (also circular) grows.

Heri

> -----Original Message-----
> From: Integrator [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 12, 2007 8:47 PM
> To: log4j-user@logging.apache.org
> Subject: [SPAM (Bayesain Analysis)] - Advantages of using static log
> methods vs sub classes methods - Bayesian Filter detected spam
> 
> 
> 
> Hi ,
> 
> I am comparing the advantages and disadvantages using log4j 
> at its own vs
> some sub classes (or wrapper classes) with methods for 
> logging messages from
> application.
> 
> 
> Which one is better and why ? So far i could understand Utilization of
> wrapper ensures that you are not tied to specific logging solutions.
> 
> Is that it or there is something more ? Please express your views and
> experience on it.
> 
> Thanks,
> Integrator
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Advantages-of-using-static-log-methods-v
> s-sub-classes-methods-tf4793407.html#a13712766
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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