Package com.digitizer.logging
Class LoggingConfig
java.lang.Object
com.digitizer.logging.LoggingConfig
Central logging configuration metadata for the Graph Digitizer application.
This class exposes constants that mirror settings in log4j2.xml so
other components can reference log file locations without hard-coding
duplicate strings. It does not mutate Log4j2 configuration at
runtime; Log4j2 picks up its XML configuration during initialization.
Async Logging: To enable high-throughput asynchronous logging, start the JVM with the system property:
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelectorThis engages the
<AsyncRoot> logger defined in log4j2.xml.
Ensure the LMAX Disruptor dependency is present (declared in the Maven
pom.xml).
JSON Logs: Structured events are written to the file
referenced by JSON_LOG_FILE. Each line is a standalone JSON object
suitable for ingestion by log processors (e.g., ELK, Splunk) using a
newline-delimited JSON parser.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringConvenience method to generate a simple session identifier based on current timestamp.static voidinitializeMdc(String sessionId, String userId) Initialize basic MDC (Mapped Diagnostic Context) keys used for correlation.static voidlogStartupBanner(String appVersion) Emits a diagnostic message confirming logging backend activation.static voidPerforms lightweight environment checks and logs findings: Java version Async logger property presence Log directory existence / creation
-
Field Details
-
TEXT_LOG_FILE
Name of the primary rolling text log file.- See Also:
-
JSON_LOG_FILE
Name of the JSON structured log file.- See Also:
-
-
Method Details
-
logStartupBanner
Emits a diagnostic message confirming logging backend activation. Intended for optional startup health checks.- Parameters:
appVersion- the application version string to include in the banner
-
initializeMdc
Initialize basic MDC (Mapped Diagnostic Context) keys used for correlation. This attaches a session identifier and (optionally) a user id if supplied.- Parameters:
sessionId- unique identifier for this application run (e.g. timestamp or random UUID)userId- optional user id (null if not applicable)
-
runEnvironmentChecks
public static void runEnvironmentChecks()Performs lightweight environment checks and logs findings:- Java version
- Async logger property presence
- Log directory existence / creation
-
generateSessionId
Convenience method to generate a simple session identifier based on current timestamp.- Returns:
- session id string
-