2016-06-27 7 views
7

Ist das ein Fehler in Logback-Klassiker oder fehlt mir etwas? The documentation ist ziemlich explizit über scanPeriod ein optionales Attribut zu sein:scanPeriod-Attribut wird von Logback-Classic für die automatische Neuinstallation benötigt, um zu arbeiten

Standardmäßig wird die Konfigurationsdatei für Änderungen einmal jede Minute gescannt werden.

jedoch gegeben eine logback.xml Datei wie unten:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration debug="true" scan="true" >   
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> 
     <encoder> 
      <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5p %c{1}:%L - %m%n</pattern> 
      <charset>utf8</charset> 
     </encoder> 
    </appender> 
    <root level="WARN"> 
     <appender-ref ref="CONSOLE" /> 
    </root> 
</configuration> 

ich die folgende Ausgabe von logback erhalten und Scan funktioniert nicht Arbeit.

16:40:56,244 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 
16:40:56,244 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 
16:40:56,244 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/home/jbochenski/acme/acme-func-test/conf/logback.xml] 
16:40:56,323 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 
16:40:56,325 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE] 
16:40:56,331 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 
16:40:56,354 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN 
16:40:56,355 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[ROOT] 
16:40:56,355 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 
16:40:56,356 |-INFO in [email protected] - Registering current configuration as safe fallback point 

Allerdings, wenn ich ändern, nur die Konfiguration scanPeriod Attribut <configuration debug="true" scan="true" scanPeriod="1 minute"> hinzufügen, um es zu arbeiten beginnt:

16:43:44,584 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 
16:43:44,585 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 
16:43:44,585 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/home/jbochenski/acme/acme-func-test/conf/logback.xml] 
16:43:44,686 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/home/jbochenski/acme/acme-func-test/conf/logback.xml] 
16:43:44,686 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 1 minutes 
16:43:44,688 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 
16:43:44,691 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE] 
16:43:44,700 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 
16:43:44,727 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN 
16:43:44,727 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[ROOT] 
16:43:44,727 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 
16:43:44,728 |-INFO in [email protected] - Registering current configuration as safe fallback point 

Verwendung:

  • logback-classic: 1.1.7
  • slf4j: 1.7. 13

Antwort

8

UPDATE: Siehe LOGBACK-1194


Das sieht in der Tat wie ein logback Fehler, und ich empfehle die Einreichung ein Problem in JIRA.

In 1.1.7, einige refactoring was done, die Auswirkungen auf die scanPeriod behandelt. Die Änderungen enthalten abandoning the scan option altogether when no scanPeriod is specified. Ich denke nicht, dass das beabsichtigt war.

+0

Fertig: http://jira.qos.ch/browse/LOGBACK-1194 Können Sie bitte Ihre Antwort mit dem Link der Vollständigkeit halber aktualisieren? –

+0

@JakubBochenski done – tony19

+0

Ich benutze Version 1.2.3 und es scheint immer noch kaputt, leider. – matsa