Skip to content

Commit

Permalink
feat: Log timestamps according to ISO 8601
Browse files Browse the repository at this point in the history
Use "T" as delimiter between date and time as in ISO 8601 [1]. This
simplifies parsing the timestamps as they do not contain whitespace
anymore which caused tools like `logfmt` [2] to read only the date.

[1]: https://en.wikipedia.org/wiki/ISO_8601
[2]: https://grafana.com/docs/loki/latest/send-data/promtail/stages/logfmt/

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
  • Loading branch information
mnonnenmacher committed Jan 2, 2025
1 parent 79315e9 commit 65aa59d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<conversionRule conversionWord="customMdc" converterClass="org.eclipse.apoapsis.ortserver.utils.logging.MdcConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>time=%d{YYYY-MM-dd HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
<pattern>time=%d{YYYY-MM-dd'T'HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
</encoder>
</appender>
<root level="trace">
Expand Down
2 changes: 1 addition & 1 deletion dao/src/testFixtures/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<conversionRule conversionWord="customMdc" converterClass="org.eclipse.apoapsis.ortserver.utils.logging.MdcConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>time=%d{YYYY-MM-dd HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
<pattern>time=%d{YYYY-MM-dd'T'HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
</encoder>
</appender>

Expand Down
2 changes: 1 addition & 1 deletion kubernetes/jobmonitor/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<conversionRule conversionWord="customMdc" converterClass="org.eclipse.apoapsis.ortserver.utils.logging.MdcConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>time=%d{YYYY-MM-dd HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
<pattern>time=%d{YYYY-MM-dd'T'HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
</encoder>
</appender>
<root level="INFO">
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<conversionRule conversionWord="customMdc" converterClass="org.eclipse.apoapsis.ortserver.utils.logging.MdcConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>time=%d{YYYY-MM-dd HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
<pattern>time=%d{YYYY-MM-dd'T'HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
</encoder>
</appender>
<root level="INFO">
Expand Down
2 changes: 1 addition & 1 deletion utils/test/src/commonMain/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<conversionRule conversionWord="customMdc" converterClass="org.eclipse.apoapsis.ortserver.utils.logging.MdcConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>time=%d{YYYY-MM-dd HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
<pattern>time=%d{YYYY-MM-dd'T'HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
</encoder>
</appender>

Expand Down
2 changes: 1 addition & 1 deletion workers/common/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<conversionRule conversionWord="customMdc" converterClass="org.eclipse.apoapsis.ortserver.utils.logging.MdcConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>time=%d{YYYY-MM-dd HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
<pattern>time=%d{YYYY-MM-dd'T'HH:mm:ss.SSS} thread=%thread %customMdc level=%-5level logger=%logger{36} message="%replace(%msg){'\"','\\\"'}"%n</pattern>
</encoder>
</appender>
<root level="INFO">
Expand Down

0 comments on commit 65aa59d

Please sign in to comment.