logback.xml 1.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
  <springProfile name="local">
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
      <encoder>
        <pattern>%yellow([%thread]) %highlight(| %-5level |) %green(%d) %cyan(| %logger{15} |) %highlight(%msg) %n</pattern>
        <charset>utf8</charset>
      </encoder>
    </appender>
    <root level="DEBUG">
      <appender-ref ref="CONSOLE"/>
    </root>
  </springProfile>

  <springProfile name="!local">
    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
      <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
        <layout class="ch.qos.logback.contrib.json.classic.JsonLayout">
          <timestampFormat>yyyy-MM-dd HH:mm:ss.SSS</timestampFormat>
          <timestampFormatTimezoneId>Etc/UTC</timestampFormatTimezoneId>
          <appendLineSeparator>true</appendLineSeparator>

          <jsonFormatter class="org.opengroup.osdu.core.gcp.logging.formatter.GoogleJsonFormatter">
            <prettyPrint>false</prettyPrint>
          </jsonFormatter>
        </layout>
      </encoder>
    </appender>

    <root level="debug">
      <appender-ref ref="stdout"/>
    </root>
  </springProfile>

</configuration>