You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by David Miller <da...@claero.com> on 2004/09/11 21:01:01 UTC

Debug Level

I'm a newbie to Log4j, but have been programming in Java for years.

I'm relatively new to using Log4j after using System.out.println() for
years and years, and have run into a (REALLY BASIC) problem that I can't
seem to find a solution to. Here it is...

After setting the level for my logger using logger.setLevel((Level)
Level.DEBUG), it never actually logs any of the debug() statements, but
it will execute any of the other statements  -- info(), warn(), error(),
fatal().


For example, the following code:

/* */
logger.setLevel((Level) Level.DEBUG);
logger.debug("debug");
logger.info("info");
logger.warn("warn");
logger.error("error");
logger.fatal("fatal");
/* */

will print out the following:

/* */
- info
- warn
- error
- total
/* */

Which is to be expected, but the debug statement is not included.

Whereas the following code:

/* */
logger.setLevel((Level) Level.WARN);
logger.debug("debug");
logger.info("info");
logger.warn("warn");
logger.error("error");
logger.fatal("fatal");
/* */

will print out the following:

/* */
- warn
- error
- total
/* */

And 

/* */
logger.setLevel((Level) Level.ALL);
logger.debug("debug");
logger.info("info");
logger.warn("warn");
logger.error("error");
logger.fatal("fatal");
/* */

will print out the following:

/* */
- info
- warn
- error
- total
/* */ 


So my debug statements are never logged. Am I missing something very
basic here? Thanks.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org