Skip to content

Configuring the JavaLogFactory

Kevin W. Wall edited this page May 30, 2024 · 4 revisions

Important Note

This only applies if you are using ESAPI 2.5.4.0 or a subsequent 2.x release.

Java 8 Configuration

To configure the JavaLogFactory for ESAPI configure the java.util.logging.LogManager instance within the jvm by specifying

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

An Application Restart may be required for changes to take effect.

Refer to the java LogManager Documentation for more information on how to customize and configure Java Logging for the application.

In previous deliveries of the ESAPI library, the esapi-java-logging.properties file would default to:

handlers= java.util.logging.ConsoleHandler
.level= INFO
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] [%3$-7s] %5$s %n

Starting with 2.5.4.0 and later 2.x releases, you must DELETE this esapi-java-logging.properties file if you are using ESAPI's default logging which is JUL. Failure to do so will result in a ConfigurationException being thrown, which may appear as a java.lang.ExceptionInInitializerError or as a java.lang.NoClassDefFoundError, depending on various circumstances.

References:

Github Issue #839