Skip to content

Commit

Permalink
[backend] Improvment - better logging (#1418)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimfacion authored Sep 27, 2024
1 parent 32464a1 commit 79deada
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
20 changes: 20 additions & 0 deletions openbas-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,26 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>ch.qos.logback.contrib</groupId>
<artifactId>logback-json-classic</artifactId>
<version>0.1.5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback.contrib</groupId>
<artifactId>logback-jackson</artifactId>
<version>0.1.5</version>
</dependency>
</dependencies>

<build>
Expand Down
24 changes: 24 additions & 0 deletions openbas-api/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<configuration>
<springProfile name="dev">
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>

<root>
<appender-ref ref="STDOUT" />
</root>
</springProfile>
<springProfile name="!dev">
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="jsonEncoder" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.JsonEncoder"/>
</appender>

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

0 comments on commit 79deada

Please sign in to comment.