logging – Quartz keeps putting its log on all my log files – Education Career Blog

I have a problem. Quartz keeps putting its log on all my log files. Can I redirect Quart’s log to a separate file? Here is my 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>

,

Add this line to your logback config file:

<logger name="org.quartz">
  <level value="info" />
</logger>

,

Actually if you wanted to log the Quartz to separate log file, then create an appender and associate it to 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>

Leave a Comment