我有以下logback.xml
配置:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logFile.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%-4relative [%thread] %highlight(%-5level) %cyan(%logger{35}) - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
</configuration>
如果我在 eclipse (Juno) 中编辑配置文件,我会收到以下错误:
11:02:54,114 INFO [main] Main - javax.xml.transform.TransformerFactory=null
11:02:54,115 INFO [main] Main - java.endorsed.dirs=C:\Program Files\Java\jre7\lib\endorsed
11:02:54,117 INFO [main] Main - launchFile: C:\Users\roberth\Programming_Projects\eclipse\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml
11:02:54,145 FATAL [main] Main - No embedded stylesheet instruction for file: file:/C:/Users/roberth/Programming_Projects/eclipse/javaport/src/logback.xml
org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/C:/Users/roberth/Programming_Projects/eclipse/javaport/src/logback.xml
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:225)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73)
Caused by: org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/C:/Users/roberth/Programming_Projects/eclipse/javaport/src/logback.xml
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:214)
... 2 more
如果我删除并重新创建配置,有时它可以工作,有时不能。如果我在 Notepad++ 或其他文本编辑器中编辑文件,它工作正常。这是日食问题还是我错过了什么?