我嘗試在春季啓動下面的配置使用的logback,的logback不會在春季啓動工作
我試圖sperate日誌爲兩種類型:系統日誌文件和業務日誌文件,
但日誌只顯示在控制檯上,
沒有生成日誌文件,有人可以幫忙嗎?
是否有必要在spring啓動配置文件中做一些配置?的
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<appender name="ROOT_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/sif-interface-sys.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_DIR}/${SYSTEM_NAME}/system.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>500MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%-20(%d{yyy-MM-dd HH:mm:ss.SSS} [%X{requestId}]) %-5level - %logger{80} - %msg%n
</pattern>
</encoder>
</appender>
<appender name="BUSINESS_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/sif-interface-business.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_DIR}/${SYSTEM_NAME}/business.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>500MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%-20(%d{yyy-MM-dd HH:mm:ss.SSS} [%X{requestId}]) %-5level - %logger{80} - %msg%n
</pattern>
</encoder>
</appender>
<logger name="org.springframework.web" level="INFO">
<appender-ref ref="ROOT_APPENDER" />
</logger>
<logger name="{project-package}" level="INFO">
<appender-ref ref="BUSINESS_APPENDER" />
</logger>
</configuration>
你有沒有指定它應該使用哪個軟件包business_appender – pvpkiran
@pvpkiran如何做到這一點? –