Logging

Levels

SEVERE

The highest value; intended for extremely important messages

WARNING

Intended for warning messages.

INFO

Informational runtime messages.

CONFIG

Informational messages about configuration settings/setup

FINE

Used for greater detail, when debugging/diagnosing problems

FINER

Even greater detail.

FINEST

The lowest value; greatest detail.

Properties File

Here is a sample logging.properties file:

../../misc/howto/java/logging.properties

Note: This file is not loaded by default. You must specify the file as a JVM property e.g.

-Djava.util.logging.config.file=/path/to/file/logging.properties

Sample

import java.util.logging.Logger;

    /** Standard logger. */
    private static Logger logger = Logger.getLogger(MyClass.class.getName());


    public void myMethod() {
        logger.fine("myMethod()");
    }