Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The standard steering files are in trunk/steering-files/src/main/resources/org/hps/steering/.

Logging and Debugging

Logging Config

HPS Java uses the built-in logging facilities of Java described in the logging package documentation.

...

In this config, any class in the org.hps.evio package will have a log level of CONFIG.

Log Levels

These are the available log levels, in descending order.

LevelDescriptionUse
SEVEREsevere error message usually meaning program should haltunrecoverable errors that halt the program
WARNINGwarning message indicating a non-fatal error or problemwarning messages
INFOinformational messagesinformational messages that should usually print when the program runs
CONFIGconfiguration messagesprinting out config information for a class or tool
FINE debug print outshigh level debugging messages that should not typically be active 
FINER more verbose debug print outsmore verbose debugging messages 
FINEST most verbose debug messagesthe most verbose debugging messages 
ALLprint all error messages when logger should always print all messages
OFFdisable all messages 
   
when logger should be completely disabled from printing

Each logger inherits by default from the global log setting.

...

So if a package is not explicitly configured, it will inherit the WARNING log level from the global logger.

Defining Loggers

A logger should typically be defined as follows in an HPS Java class.

Code Block
languagejava
package org.example;
 
import java.util.logging.Logger;
 
class MyClass {
 
    static private final Logger LOGGER = Logger.getLogger(MyClass.class.getPackage().getName());
 
    void someMethod() {
        LOGGER.info("some method was called");
    }
}

The class uses a package rather than class logger.

The handler and the level should not be assigned in the code, as this will instead be configured in the logging config file.