logback.xml

    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <configuration>
    3. <contextName>|</contextName>
    4. <property name="logback.logdir" value="logs"/>
    5. <property name="logback.appname" value="pay-voucher-service"/>
    6. <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
    7. <layout class="ch.qos.logback.classic.PatternLayout">
    8. <pattern>%d{HH:mm:ss.SSS} %contextName %-5level %logger{36}[%X{}] - %msg%n</pattern>
    9. </layout>
    10. </appender>
    11. <appender name="appInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
    12. <File>${logback.logdir}/${HOSTNAME}.${logback.appname}.info.log</File>
    13. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    14. <FileNamePattern>${logback.logdir}/${HOSTNAME}.${logback.appname}.info.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
    15. <maxHistory>90</maxHistory>
    16. <timeBasedFileNamingAndTriggeringPolicy
    17. class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    18. <maxFileSize>50MB</maxFileSize>
    19. </timeBasedFileNamingAndTriggeringPolicy>
    20. </rollingPolicy>
    21. <encoder>
    22. <pattern>%d [%thread] %-5level %logger{36} %line [%X{}] - %msg%n</pattern>
    23. </encoder>
    24. </appender>
    25. <appender name="appErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
    26. <File>${logback.logdir}/${HOSTNAME}.${logback.appname}.error.log</File>
    27. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    28. <FileNamePattern>${logback.logdir}/${HOSTNAME}.${logback.appname}.error.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
    29. <maxHistory>90</maxHistory>
    30. <timeBasedFileNamingAndTriggeringPolicy
    31. class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    32. <maxFileSize>50MB</maxFileSize>
    33. </timeBasedFileNamingAndTriggeringPolicy>
    34. </rollingPolicy>
    35. <encoder>
    36. <pattern>%d [%thread] %-5level %logger{36} %line [%X{}] - %msg%n</pattern>
    37. <charset>utf-8</charset>
    38. </encoder>
    39. <filter class="ch.qos.logback.classic.filter.LevelFilter">
    40. <level>error</level>
    41. <onMatch>ACCEPT</onMatch>
    42. <onMismatch>DENY</onMismatch>
    43. </filter>
    44. </appender>
    45. <logger name="org.springframework.web" level="INFO"/>
    46. <logger name="org.springframework.security" level="ERROR"/>
    47. <logger name="org.springframework.security" level="INFO"/>
    48. <logger name="org.springframework" level="ERROR"/>
    49. <logger name="org.springframework.cloud" level="DEBUG"/>
    50. <root level="INFO">
    51. <appender-ref ref="consoleLog" />
    52. <appender-ref ref="appInfoLog" />
    53. <appender-ref ref="appErrorLog" />
    54. </root>
    55. </configuration>