Java Logging: Log Levels

Jakob Jenkov
Last update: 2014-06-23

When a message is logged via a Logger it is logged with a certain log level. The built-in log levels are:

  • INFO
  • FINE

The log level is represented by the class java.util.logging.Level. This class contains a constant for each of the above log levels. It is one of these constants you use when you log a message to a Logger. Here is an example:

logger.log(Level.SEVERE, "A severe message!");

Filtering Messages

You can filter the messages by their log level, meaning you can configure a Logger to not log, and not propagate messages below a certain level. Here is an example of that:


The Logger now ignores all messages below the log level WARNING.

To understand how log levels behave in the Logger hierarchy, check out the text on the Logger hierarchy.

Jakob Jenkov

Featured Videos

Core Software Performance Optimization Principles

Thread Congestion in Java - Video Tutorial

Close TOC

All Trails

Trail TOC

Page TOC