|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<configuration> |
| 3 | + <include resource="org/springframework/boot/logging/logback/defaults.xml"/> |
| 4 | + |
| 5 | + <springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="ifu-server"/> |
| 6 | + <springProperty scope="context" name="ENVIRONMENT" source="sentry.environment" defaultValue="local"/> |
| 7 | + |
| 8 | + <!-- 콘솔 출력 (로컬 개발용) --> |
| 9 | + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| 10 | + <encoder> |
| 11 | + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) [%thread] %cyan(%logger{36}) - %msg%n</pattern> |
| 12 | + </encoder> |
| 13 | + </appender> |
| 14 | + |
| 15 | + <!-- JSON 출력 (운영 환경용) --> |
| 16 | + <appender name="JSON" class="ch.qos.logback.core.ConsoleAppender"> |
| 17 | + <encoder class="net.logstash.logback.encoder.LogstashEncoder"> |
| 18 | + <customFields>{"service":"${APP_NAME}","environment":"${ENVIRONMENT}"}</customFields> |
| 19 | + <includeMdc>true</includeMdc> |
| 20 | + <includeContext>false</includeContext> |
| 21 | + <includeCallerData>false</includeCallerData> |
| 22 | + <timestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampPattern> |
| 23 | + <timeZone>UTC</timeZone> |
| 24 | + <shortenedLoggerNameLength>36</shortenedLoggerNameLength> |
| 25 | + </encoder> |
| 26 | + </appender> |
| 27 | + |
| 28 | + <!-- 로컬: 콘솔 포맷 --> |
| 29 | + <springProfile name="local"> |
| 30 | + <root level="INFO"> |
| 31 | + <appender-ref ref="CONSOLE"/> |
| 32 | + </root> |
| 33 | + <logger name="com.ifu" level="DEBUG"/> |
| 34 | + </springProfile> |
| 35 | + |
| 36 | + <!-- 스테이징: JSON 포맷 --> |
| 37 | + <springProfile name="staging"> |
| 38 | + <root level="INFO"> |
| 39 | + <appender-ref ref="JSON"/> |
| 40 | + </root> |
| 41 | + <logger name="com.ifu" level="DEBUG"/> |
| 42 | + </springProfile> |
| 43 | + |
| 44 | + <!-- 운영: JSON 포맷 --> |
| 45 | + <springProfile name="prod"> |
| 46 | + <root level="INFO"> |
| 47 | + <appender-ref ref="JSON"/> |
| 48 | + </root> |
| 49 | + <logger name="com.ifu" level="INFO"/> |
| 50 | + </springProfile> |
| 51 | +</configuration> |
0 commit comments