Re: Advantages of using static log methods vs sub classes methods
A wrapper class (if you use something I suggest that you use something that is has been well-tested like commons-logging instead of writing your own) allows you to switch logger implementations but probably prohibits the use of some functionality. I would suggest using a wrapper only if you foresee the need to change logger (i.e. if you are writing a framework and want to leave the logger choice to someone else). On Nov 12, 2007 1:46 PM, Integrator [EMAIL PROTECTED] wrote: 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-vs-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] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: Advantages of using static log methods vs sub classes methods
The loggers instance are being generated from a factory pattern in a j2ee aplication and implements the log methods from wrapper class. Rather then calling default logging methods from Logger (Catagory) Class. Thanks. James A. N. Stauffer wrote: A wrapper class (if you use something I suggest that you use something that is has been well-tested like commons-logging instead of writing your own) allows you to switch logger implementations but probably prohibits the use of some functionality. I would suggest using a wrapper only if you foresee the need to change logger (i.e. if you are writing a framework and want to leave the logger choice to someone else). On Nov 12, 2007 1:46 PM, Integrator [EMAIL PROTECTED] wrote: 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-vs-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] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ -- View this message in context: http://www.nabble.com/Advantages-of-using-static-log-methods-vs-sub-classes-methods-tf4793407.html#a13713254 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Advantages of using static log methods vs sub classes methods
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]