I'm confused about how to control logging levels. I'd expect this code:
import java.util.logging.Logger;
import java.util.logging.Level;
public class LoggerTest {
private static Logger log =
Logger.getLogger(LoggerTest.class.getName());
public static void main(String [] args) {
log.setLevel(Level.ALL);
log.severe("severe message");
log.warning("warning message");
log.info("info message");
log.fine("fine message");
log.finer("finer message");
log.finest("finest message");
}
}
to print all six log.* messages to the console, but instead I get the
default behavior of only printing severe, warning and info.
Where have I gone astray?
Thanks.
--
-- Steve
Hmm, after some experimentation, I can make the code below work as I
expect, but only if I create a logging.properties file with this setting:
java.util.logging.ConsoleHandler.level = ALL
and invoke the program as
java -Djava.util.logging.config.file=logging.properties LoggerTest
But, I'm still confused. I would expect that each approach should work
by itself. In other words, either set the level specifically in the
code, or set it at runtime via the logging.properties file. Having to
do both together seems odd to me.
Can anyone out there clarify this for me? I'm pretty sure I'm not using
the logger properly.
Thanks.
--
-- Steve
> I'm confused about how to control logging levels. I'd expect this code:
>
[quoted text clipped - 20 lines]
>
> Thanks.