我目前正在從log4j移動到logback,並使用它們在logback主頁中提供的轉換器轉換我的log4j.properties文件。但我讓我的模式一些奇怪的錯誤,我無法弄清楚什麼要我做的:從log4j轉換後的Logback模式異常
<?xml version="1.0" encoding="UTF-8"?> <!-- For assistance related to logback-translator or configuration --> <!-- files in general, please contact the logback user mailing list --> <!-- at http://www.qos.ch/mailman/listinfo/logback-user --> <!-- --> <!-- For professional support please see --> <!-- http://www.qos.ch/shop/products/professionalSupport --> <!-- --> <configuration> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{ISO8601} [%p] [%C{1},%M(),%L] - %m%n</pattern> </encoder> </appender> <appender name="R" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender--> <File>/log/debug.log</File> <encoder> <pattern>%d{ISO8601} %15.15t [%p] [%C{1},%M():%L] - %m%n</pattern> </encoder> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <maxIndex>1</maxIndex> <FileNamePattern>/log/debug.log.%i</FileNamePattern> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <MaxFileSize>100KB</MaxFileSize> </triggeringPolicy> </appender> <root level="debug"> <appender-ref ref="stdout"/> <appender-ref ref="R"/> </root> </configuration>
和這裏是我得到的錯誤:
18: 02:29,368 | -ERROR in [email protected] - 無法將轉換器類[ch.qos.logback.classic.pattern.MethodOfCallerConverter]實例化爲關鍵字[M]的複合轉換器, ch.qos.logback.core.util.IncompatibleClassException at ch.qos.logback.core.util.IncompatibleClassException at at ch.qos.logback.core.util.OptionHelper.instantiateByClassNameAndParameter(OptionHelper.java:62) at at ch.qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:48) at at ch .qos.logback.core.util.OptionHelper.instantiateByClassName(OptionHelper.java:35) at at ch.qos.logback.core.pattern.parser.Compiler.createCompositeConverter(Compiler.java:135) at at ch.qos .logback.core.pattern.parser.Compiler.compile(Compiler.java:47) at at ch.qos.logback.core.pattern.parser.Parser.compile(Parser.java:91) at at ch.qos .logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:86) at at ch.qos.logback.classic.encoder.PatternLayoutEncoder.start(PatternLayoutEncoder.java:28) at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167) at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317) at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196) at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182) at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62) 處ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149) 處CH。 qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135) at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99) at at ch.qos.logback。 core.joran.Generic Configurator.doConfigure(GenericConfigurator.java:49) at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75) at at ch.qos.logback.classic.util.ContextInitializer.autoConfig( ContextInitializer.java:148) at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85) at at org.slf4j.impl.StaticLoggerBinder。(StaticLoggerBinder.java:55) at at org.slf4j。 LoggerFactory.bind(LoggerFactory.java:128) 處org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107) 處org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295) 處org.slf4j .LoggerFactory.getLogger(LoggerFactory.java:269) at at org.slf4j.LoggerFactory.getLogger(Lo ggerFactory.java:281) 處taxonomyParser(taxonomyParser.java:34) 18:02:29368 |·ERROR在[email protected] - 無法爲創建轉換器[。 %M]關鍵字
我不明白這是因爲在文檔頁面上他們清楚地說%M是Method的修飾符。
謝謝。
謝謝。完全正確 – Gleeb
+1你是男人。 – asgs