Configuring esapi to use an existing logger implementation #709
Replies: 5 comments 9 replies
-
The ESAPI JavaLogFactory attempts to configure the instance through the esapi-java-logging.properties file. An optional default configuration for that properties file is provided in the esapi configuration directory here. Fair to assume that the esapi project default is not your system configuration. The easiest option I see is to update the esapi-java-logging.properties file to be the configuration you're expecting. You can do that by either updating the file in-place or by creating a sim-link on your system to your preferred configuration settings. There may be a case to create an issue in the project to make that configuration file optional, which would require a code change. I believe that would also address the problem, but I'd be interested in whether @kwwall or @xeno6696 would have concerns with that implementation change. |
Beta Was this translation helpful? Give feedback.
-
Created Issue #710 for consideration in the project. I believe that change would have mitigated this use case without requiring changes on your part. |
Beta Was this translation helpful? Give feedback.
-
@kwwall - our application configures JUL per our own configuration file well before esapi is ever loaded. Currently, loading esapi causes our logging configuration to be overwritten by esapi's logging configuration. This is clearly not desirable. We want esapi to use the JUL api to log events, but to use the logging configuration that we have already set up. I propose a new property in ESAPI.properties to configure this (e.g. This option should be easy to implement for all logging frameworks. |
Beta Was this translation helpful? Give feedback.
-
We've done a bit more looking into the Java LogManager, and I believe a path forward has been identified. Per the javadoc on the LogManager class, two existing properties may be used to centralize the log configuration:
The ESAPI JavaLogFactory should not conflict with those settings, if they are defined. #710 is being updated to account for this intent. If the LogManager property exists in the environment, then the ESAPI configuration will not be applied. @chuckdumont, I believe this will fulfill the use case you're wanting in future releases while still allowing ESAPI to enforce behavior if none is defined. Specifically identifying the intent such that: |
Beta Was this translation helpful? Give feedback.
-
@chuckdumont wrote:
See reply in #710 (comment) |
Beta Was this translation helpful? Give feedback.
-
Our application uses java.util.logging and handles logging configuration (setting handlers, log levels, etc.). When using esapi with JUL logging, the application's configured log levels are reset by esap. How can we configure esapi to use the java.util.logging APIs to log events, but not try to set it's own logging config?
Beta Was this translation helpful? Give feedback.
All reactions