Skip to content

Commit

Permalink
[backend] Properly log to json
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimfacion committed Sep 27, 2024
1 parent 9429dde commit 5c28578
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion openbas-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ minio.access-secret=<secret>
# Logging
logging.level.root=fatal
logging.level.org.flywaydb=error
logging.level.io.openbas=error
logging.level.io.openbas=debug
logging.file.name=./logs/openbas.log
logging.logback.rollingpolicy.file-name-pattern=${LOG_FILE}.-%d{yyyy-MM-dd}.%i
logging.logback.rollingpolicy.max-file-size=10MB
Expand Down
12 changes: 3 additions & 9 deletions openbas-api/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@
</springProfile>
<springProfile name="!dev">
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="json" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
<jsonFormatter
class="ch.qos.logback.contrib.jackson.JacksonJsonFormatter">
<prettyPrint>true</prettyPrint>
</jsonFormatter>
<timestampFormat>yyyy-MM-dd' 'HH:mm:ss.SSS</timestampFormat>
</layout>
<appender name="jsonEncoder" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.JsonEncoder"/>
</appender>

<root level="debug">
<appender-ref ref="json" />
<appender-ref ref="jsonEncoder" />
</root>
</springProfile>
</configuration>

0 comments on commit 5c28578

Please sign in to comment.