-
Notifications
You must be signed in to change notification settings - Fork 21
X-Trace-ID and structured logging output. #1682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MikeNeilson
wants to merge
9
commits into
develop
Choose a base branch
from
feature/1666-trace-id
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
86b3c4d
Initial trace id using a bit of a hack.
MikeNeilson 65a4205
Working Flogger ScopedLoggerContext.
MikeNeilson ab407ad
WIP, tomcat messages not logged during integration test.
MikeNeilson 2fff3e1
Logback working locally, normal logging in docker compose.
MikeNeilson a953cac
New logging working in container.
MikeNeilson b3d34b5
Cleanup, correct test behavior.
MikeNeilson cd0e694
Apply suggestion from @krowvin
MikeNeilson 0f0b852
Merge branch 'develop' into feature/1666-trace-id
MikeNeilson f2c33a8
Improved Trace ID error handling, with tests. Improve log output.
MikeNeilson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <!DOCTYPE configuration> | ||
| <configuration> | ||
| <import class="ch.qos.logback.classic.encoder.JsonEncoder"/> | ||
| <import class="ch.qos.logback.core.ConsoleAppender"/> | ||
| <import class="ch.qos.logback.core.FileAppender"/> | ||
| <variable name="LOG_LEVEL" value="${LOG_LEVEL:-FINE}"/> | ||
| <contextName>CWMS-Data-API</contextName> | ||
| <appender name="STDERR" class="ConsoleAppender"> | ||
| <encoder class="JsonEncoder"/> | ||
| <target>System.err</target> | ||
| </appender> | ||
|
|
||
| <appender name="FILE" class="FileAppender"> | ||
| <encoder class="JsonEncoder"/> | ||
| <append>false</append> | ||
| <immediateFlush>true</immediateFlush> | ||
| <file>build/cda.jsonl</file> | ||
| </appender> | ||
|
|
||
| <appender name="FILE-PLAIN" class="FileAppender"> | ||
| <encoder> | ||
| <!-- Format includes date, level, MDC userId, and message --> | ||
| <pattern>%d [%thread] %-5level - %X{traceId:-none} - %logger - %msg %ex %n</pattern> | ||
| </encoder> | ||
| <append>false</append> | ||
| <immediateFlush>true</immediateFlush> | ||
| <file>build/cda-plain.log</file> | ||
| </appender> | ||
|
|
||
| <logger name="cwms.cda" level="${LOG_LEVEL}"/> | ||
| <logger name="fixtures" level="${LOG_LEVEL}"/> | ||
| <logger name="org.apache" level="ERROR"/> | ||
|
|
||
| <root level="INFO"> | ||
| <appender-ref ref="STDERR"/> | ||
| <appender-ref ref="FILE"/> | ||
| <appender-ref ref="FILE-PLAIN"/> | ||
| </root> | ||
| </configuration> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Context antiResourceLocking="true" delegate="true"> | ||
| <ResourceLink | ||
| name="jdbc/CWMS3" | ||
| global="jdbc/CWMS3" | ||
| type="javax.sql.DataSource" | ||
| /> | ||
| </Context> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <!DOCTYPE configuration> | ||
| <configuration debug="true"> | ||
| <import class="org.apache.juli.logging.ch.qos.logback.classic.encoder.JsonEncoder"/> | ||
| <import class="org.apache.juli.logging.ch.qos.logback.core.ConsoleAppender"/> | ||
|
|
||
| <variable name="LOG_LEVEL" value="${LOG_LEVEL:-INFO}"/> | ||
| <contextName>CWMS-Data-API</contextName> | ||
| <appender name="STDERR" class="ConsoleAppender"> | ||
| <encoder class="JsonEncoder"/> | ||
| <target>System.err</target> | ||
| </appender> | ||
|
|
||
| <logger name="cwms.cda" level="${LOG_LEVEL}"/> | ||
| <logger name="org.apache" level="ERROR"/> | ||
|
|
||
| <logger name="org.apache.catalina" level="INFO" additivity="false"> | ||
| <appender-ref ref="STDERR" /> | ||
| </logger> | ||
|
|
||
| <logger name="org.apache.catalina.core.ContainerBase.[Catalina]" level="INFO" additivity="false"> | ||
| <appender-ref ref="STDERR" /> | ||
| </logger> | ||
|
|
||
|
|
||
| <root level="INFO"> | ||
| <appender-ref ref="STDERR"/> | ||
| </root> | ||
| </configuration> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <!DOCTYPE configuration> | ||
| <configuration debug="true"> | ||
| <import class="ch.qos.logback.classic.encoder.JsonEncoder"/> | ||
| <import class="ch.qos.logback.core.ConsoleAppender"/> | ||
|
|
||
| <variable name="LOG_LEVEL" value="${LOG_LEVEL:-INFO}"/> | ||
| <contextName>CWMS-Data-API</contextName> | ||
| <appender name="STDERR" class="ConsoleAppender"> | ||
| <encoder class="JsonEncoder"/> | ||
| <target>System.err</target> | ||
| </appender> | ||
|
|
||
| <logger name="cwms.cda" level="${LOG_LEVEL}"/> | ||
| <logger name="org.apache" level="ERROR"/> | ||
|
|
||
| <logger name="org.apache.catalina" level="INFO" additivity="false"> | ||
| <appender-ref ref="STDERR" /> | ||
| </logger> | ||
|
|
||
| <logger name="org.apache.catalina.core.ContainerBase.[Catalina]" level="INFO" additivity="false"> | ||
| <appender-ref ref="STDERR" /> | ||
| </logger> | ||
|
|
||
|
|
||
| <root level="INFO"> | ||
| <appender-ref ref="STDERR"/> | ||
| </root> | ||
| </configuration> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| export CATALINA_OPTS="$CATALINA_OPTS -Dorg.apache.tomcat.util.digester.PROPERTY_SOURCE=org.apache.tomcat.util.digester.EnvironmentPropertySource" | ||
| CATALINA_OPTS="$CATALINA_OPTS -Dorg.apache.tomcat.util.digester.PROPERTY_SOURCE=org.apache.tomcat.util.digester.EnvironmentPropertySource" | ||
| CATALINA_OPTS="$CATALINA_OPTS -Djuli-logback.configurationFile=/logback-juli.xml -Djuli-logback.ContextSelector=JNDI" | ||
| CATALINA_OPTS="$CATALINA_OPTS -Dlogback.configurationFile=/logback.xml -Dlogback.ContextSelector=JNDI" | ||
|
|
||
| export CATALINA_OPTS |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity, why did this get modified for this PR?