我有问题。 Quartz不断将其日志记录在我的所有日志文件中。我可以将Quart的日志重定向到单独的文件吗?这是我的logback.xml
:
<configuration debug="false">
<appender name="hcmut.cse.virtuallab.request" class="ch.qos.logback.core.FileAppender">
<file>log/hcmut.cse.virtuallab.request.log</file>
<encoder>
<pattern>%date %level [%thread] %logger [%file:%line] %msg%n</pattern>
</encoder>
</appender>
<appender name="hcmut.cse.virtuallab.timer" class="ch.qos.logback.core.FileAppender">
<file>log/hcmut.cse.virtuallab.timer.log</file>
<encoder>
<pattern>%date %level [%thread] %logger [%file:%line] %msg%n</pattern>
</encoder>
</appender>
<logger name="root" level="debug">
<appender-ref ref="hcmut.cse.virtuallab.timer" />
<appender-ref ref="hcmut.cse.virtuallab.request" />
</logger>
</configuration>
答案 0 :(得分:7)
将此行添加到您的logback配置文件中:
<logger name="org.quartz">
<level value="info" />
</logger>
答案 1 :(得分:6)
实际上如果你想将Quartz记录到单独的日志文件中,那么创建一个appender并将它与Quartz namespace相关联
<appender name="QuartzRLFA" type="log4net.Appender.RollingFileAppender">
<file value="Logs/QuartzOnly.log"/>
<appendToFile value="true"/>
<maxSizeRollBackups value="5"/>
<maximumFileSize value="5MB"/>
<rollingStyle value="Size"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%15.15thread] %-5level %logger{2} - %message%newline%exception"/>
</layout>
</appender>
<!-- Setup the root category, add the appenders and set the default level -->
<root>
<level value="DEBUG"/>
<appender-ref ref="hcmut.cse.virtuallab.request"/>
</root>
<!-- Specify the level specific to Quartz -->
<logger name="Quartz">
<level value="ALL" />
<appender-ref ref="QuartzRLFA" />
</logger>