Add Log4j2 JsonTemplateLayout support for JSON log output#9209
Open
juanluisrp wants to merge 2 commits intomainfrom
Open
Add Log4j2 JsonTemplateLayout support for JSON log output#9209juanluisrp wants to merge 2 commits intomainfrom
juanluisrp wants to merge 2 commits intomainfrom
Conversation
Add the log4j-layout-template-json dependency and a new log4j2-json.xml configuration file that uses JsonTemplateLayout to produce structured JSON logs. Each log event includes @timestamp, level, loggerName, message, and exception fields suitable for ingestion by ELK stack or similar log aggregation tools. The file naming convention (log4j2-json.xml) makes the "JSON" option automatically available in the Admin Settings log level dropdown via the existing LoggingApi regex discovery mechanism. Harvester logs retain their existing PatternLayout as they are consumed separately.
Document Log4j2 configuration structure (appenders, pattern layout, log rotation), harvester logging via routing appender, all available logger modules, JSON logging sample output, custom log configuration creation, REST API endpoints, and troubleshooting tips. Also fix the log level preset list to match actual configuration files (PROD, INDEX, DEV, TEST, JSON — there is no SEARCH preset).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
log4j-layout-template-jsondependency to produce structured JSON logs via Log4j2'sJsonTemplateLayoutlog4j2-json.xmlconfiguration file that automatically appears as "JSON" in the Admin Settings log level dropdown (via existingLoggingApiregex discovery)@timestamp,level,loggerName,message, andexceptionfields, suitable for ELK stack ingestionPatternLayoutas they are consumed separatelyTest plan
log4j-layout-template-json-2.17.2.jarappears inweb/target/geonetwork/WEB-INF/lib/log4j2-json.xmlappears inweb/target/geonetwork/WEB-INF/classes/