logback-spring.xml 2.61 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 
 <property  name="LOG_DIR" value="${CLEA_VENUE_CONSUMER_LOG_FILE_PATH:-/logs}" />
 <property  name="LOG_FILENAME" value="${CLEA_VENUE_CONSUMER_LOG_FILE_NAME:-clea-venue-consumer}" />
 <property  name="ERROR_LOG_FILENAME" value="${CLEA_VENUE_CONSUMER_ERROR_LOG_FILE_NAME:-clea-venue-consumer}.error" />
 
    <appender name="RollingFile"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_DIR}/${LOG_FILENAME}.log</file>
        <encoder
            class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>%d %p %C{1.} [%t][%file:%line] %m%n</Pattern>
        </encoder>
 
        <rollingPolicy
            class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!-- rollover daily and when the file reaches 10 MegaBytes -->
            <fileNamePattern>${LOG_DIR}/${LOG_FILENAME}.%d{yyyy-MM-dd}.%i.log.gz
            </fileNamePattern>
            <maxFileSize>10MB</maxFileSize>
        </rollingPolicy>
    </appender>

	<appender name="RollingErrorFile"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_DIR}/${ERROR_LOG_FILENAME}.log</file>
        <encoder
            class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>%d %p %C{1.} [%t][%file:%line] %m%n</Pattern>
        </encoder>
 
        <rollingPolicy
            class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!-- rollover daily and when the file reaches 10 MegaBytes -->
            <fileNamePattern>${LOG_DIR}/${ERROR_LOG_FILENAME}.%d{yyyy-MM-dd}.%i.log.gz
            </fileNamePattern>
                <maxFileSize>10MB</maxFileSize>
        </rollingPolicy>
    </appender>

    <springProfile name="dev">
        <include resource="org/springframework/boot/logging/logback/base.xml" />
        <logger name="org.springframework" level="OFF"/>
    </springProfile>

    <springProfile name="!dev">
        <!-- LOG everything at INFO level -->
        <root level="info">
            <appender-ref ref="RollingFile" />
        </root>

        <!-- at TRACE level -->
        <logger name="trace" level="trace" additivity="false">
            <appender-ref ref="RollingFile" />
        </logger>

        <!-- at WARN level -->
        <logger name="warn" level="warn" additivity="false">
            <appender-ref ref="RollingFile" />
        </logger>

63
        <!-- at ERROR level -->
64
65
66
67
68
69
        <logger name="error" level="error" additivity="false">
            <appender-ref ref="RollingErrorFile" />
        </logger>
    </springProfile>

</configuration>