我只是尝试安装Logback-demo,使用maven打包文件并首次运行demo,但我不断收到这些奇怪的java异常消息:
10:12:03.103 [pool-3-thread-1] INFO ch.qos.logback.demo.LoggingTask - Howdydy-diddly-ho - 8499
java.lang.Exception: e
at ch.qos.logback.demo.LoggingTask.run(LoggingTask.java:28) [classes/:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_65]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65]
10:12:03,104 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Elapsed period: Thu May 21 10:11:03 PDT 2015
10:12:03,104 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [logFile.log] to [logFile.log4499498230724.tmp]
10:12:03,105 |-INFO in ch.qos.logback.core.rolling.helper.Compressor - ZIP compressing [logFile.log4499498230724.tmp] as [logFile.2015-05-21_10-11.log.zip]
这条消息会反复重复几个小时。关于我做错了什么的任何想法?
答案 0 :(得分:1)
根据source code,这看起来很正常:
public class LoggingTask implements Runnable {
// ...
public void run() {
if(i % 100 == 99) {
logger.info(HOWDY_MARKER, msg + " - " + (i++), new Exception("e"));
} else {
logger.trace("x {]", i++);
}
}
}
另请注意,此处不会抛出任何异常,只会记录它。