Search:     Advanced search
server monitoring

Poor Logging Practice: Multiple Loggers

Article ID: 196
Last updated: 09 May, 2008
Views: 354
Posted: 09 May, 2008
by: Tech Pubs S.
Updated: 09 May, 2008
by: Tech Pubs S.

Abstract

It is a poor logging practice to use multiple loggers rather than logging levels in a single class.

Description

Good logging practice dictates the use of a single logger that supports different logging levels for each class.

Examples

The following code errantly declares multiple loggers.

	public class MyClass {
	  private final static Logger good =     
				Logger.getLogger(MyClass.class);
	  private final static Logger bad =     
				Logger.getLogger(MyClass.class);
	  private final static Logger ugly =     
				Logger.getLogger(MyClass.class);
	  ...
	}

This article was:   Helpful | Not Helpful
Prev   Next
Log injection     Poor Logging Practice: Use of a System Output Stream