日志打印问题?

日志打印问题?

"C:\Program Files\Java\jdk1.8.0_251\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\IntelliJ IDEA 2020.1\lib\idea_rt.jar=55314:D:\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath "D:\IntelliJ IDEA 2020.1\lib\idea_rt.jar;D:\IntelliJ IDEA 2020.1\plugins\junit\lib\junit5-rt.jar;D:\IntelliJ IDEA 2020.1\plugins\junit\lib\junit-rt.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\rt.jar;H:\idea\o2o\target\test-classes;H:\idea\o2o\target\classes;H:\Maven\repository\junit\junit\4.13\junit-4.13.jar;H:\Maven\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;H:\Maven\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;H:\Maven\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;H:\Maven\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;H:\Maven\repository\org\springframework\spring-core\5.2.9.RELEASE\spring-core-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-jcl\5.2.9.RELEASE\spring-jcl-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-beans\5.2.9.RELEASE\spring-beans-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-context\5.2.9.RELEASE\spring-context-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-aop\5.2.9.RELEASE\spring-aop-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-expression\5.2.9.RELEASE\spring-expression-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-jdbc\5.2.9.RELEASE\spring-jdbc-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-tx\5.2.9.RELEASE\spring-tx-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-web\5.2.9.RELEASE\spring-web-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-webmvc\5.2.9.RELEASE\spring-webmvc-5.2.9.RELEASE.jar;H:\Maven\repository\org\springframework\spring-test\5.2.9.RELEASE\spring-test-5.2.9.RELEASE.jar;H:\Maven\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;H:\Maven\repository\com\fasterxml\jackson\core\jackson-databind\2.11.2\jackson-databind-2.11.2.jar;H:\Maven\repository\com\fasterxml\jackson\core\jackson-annotations\2.11.2\jackson-annotations-2.11.2.jar;H:\Maven\repository\com\fasterxml\jackson\core\jackson-core\2.11.2\jackson-core-2.11.2.jar;H:\Maven\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;H:\Maven\repository\org\mybatis\mybatis\3.5.5\mybatis-3.5.5.jar;H:\Maven\repository\org\mybatis\mybatis-spring\1.3.1\mybatis-spring-1.3.1.jar;H:\Maven\repository\mysql\mysql-connector-java\8.0.21\mysql-connector-java-8.0.21.jar;H:\Maven\repository\com\google\protobuf\protobuf-java\3.11.4\protobuf-java-3.11.4.jar;H:\Maven\repository\com\mchange\c3p0\0.9.5.5\c3p0-0.9.5.5.jar;H:\Maven\repository\com\mchange\mchange-commons-java\0.2.19\mchange-commons-java-0.2.19.jar;H:\Maven\repository\net\coobird\thumbnailator\0.4.13\thumbnailator-0.4.13.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 com.imooc.o2o.service.ShopServiceTest,testAddShop

18:10:51,559 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]

18:10:51,559 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]

18:10:51,559 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/H:/idea/o2o/target/classes/logback.xml]

18:10:51,634 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set

18:10:51,638 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/H:/idea/o2o/target/classes/logback.xml] 

18:10:51,638 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 1 minutes

18:10:51,642 |-ERROR in ch.qos.logback.core.joran.action.AppenderAction - Missing class name for appender. Near [appender] line 20

18:10:51,646 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@21:14 - no applicable action for [encoder], current ElementPath  is [[configuration][appender][encoder]]

18:10:51,646 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@23:18 - no applicable action for [pattern], current ElementPath  is [[configuration][appender][encoder][pattern]]

18:10:51,646 |-ERROR in ch.qos.logback.core.joran.action.AppenderAction - Missing class name for appender. Near [appender] line 30

18:10:51,646 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@32:15 - no applicable action for [file], current ElementPath  is [[configuration][appender][file]]

18:10:51,646 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@34:83 - no applicable action for [rollingPolicy], current ElementPath  is [[configuration][appender][rollingPolicy]]

18:10:51,646 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@36:30 - no applicable action for [fileNamePattern], current ElementPath  is [[configuration][appender][rollingPolicy][fileNamePattern]]

18:10:51,646 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@38:25 - no applicable action for [maxHistory], current ElementPath  is [[configuration][appender][rollingPolicy][maxHistory]]

18:10:51,646 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@40:18 - no applicable action for [encoder], current ElementPath  is [[configuration][appender][encoder]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:22 - no applicable action for [pattern], current ElementPath  is [[configuration][appender][encoder][pattern]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@44:67 - no applicable action for [filter], current ElementPath  is [[configuration][appender][filter]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@45:20 - no applicable action for [level], current ElementPath  is [[configuration][appender][filter][level]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@46:22 - no applicable action for [onMatch], current ElementPath  is [[configuration][appender][filter][onMatch]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@47:25 - no applicable action for [onMismatch], current ElementPath  is [[configuration][appender][filter][onMismatch]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.action.AppenderAction - Missing class name for appender. Near [appender] line 54

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@56:15 - no applicable action for [file], current ElementPath  is [[configuration][appender][file]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@57:83 - no applicable action for [rollingPolicy], current ElementPath  is [[configuration][appender][rollingPolicy]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@59:30 - no applicable action for [fileNamePattern], current ElementPath  is [[configuration][appender][rollingPolicy][fileNamePattern]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@61:25 - no applicable action for [maxHistory], current ElementPath  is [[configuration][appender][rollingPolicy][maxHistory]]

18:10:51,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@63:18 - no applicable action for [encoder], current ElementPath  is [[configuration][appender][encoder]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@64:22 - no applicable action for [pattern], current ElementPath  is [[configuration][appender][encoder][pattern]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@67:67 - no applicable action for [filter], current ElementPath  is [[configuration][appender][filter]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@68:20 - no applicable action for [level], current ElementPath  is [[configuration][appender][filter][level]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@69:22 - no applicable action for [onMatch], current ElementPath  is [[configuration][appender][filter][onMatch]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@70:25 - no applicable action for [onMismatch], current ElementPath  is [[configuration][appender][filter][onMismatch]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.action.AppenderAction - Missing class name for appender. Near [appender] line 77

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@79:15 - no applicable action for [file], current ElementPath  is [[configuration][appender][file]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@80:83 - no applicable action for [rollingPolicy], current ElementPath  is [[configuration][appender][rollingPolicy]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@82:30 - no applicable action for [fileNamePattern], current ElementPath  is [[configuration][appender][rollingPolicy][fileNamePattern]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@84:25 - no applicable action for [maxHistory], current ElementPath  is [[configuration][appender][rollingPolicy][maxHistory]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@86:18 - no applicable action for [encoder], current ElementPath  is [[configuration][appender][encoder]]

18:10:51,648 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@87:22 - no applicable action for [pattern], current ElementPath  is [[configuration][appender][encoder][pattern]]

18:10:51,649 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@90:67 - no applicable action for [filter], current ElementPath  is [[configuration][appender][filter]]

18:10:51,649 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@91:20 - no applicable action for [level], current ElementPath  is [[configuration][appender][filter][level]]

18:10:51,649 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@92:22 - no applicable action for [onMatch], current ElementPath  is [[configuration][appender][filter][onMatch]]

18:10:51,649 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@93:25 - no applicable action for [onMismatch], current ElementPath  is [[configuration][appender][filter][onMismatch]]

18:10:51,650 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.imooc.o2o] to DEBUG

18:10:51,650 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.imooc.o2o] to true

18:10:51,650 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [debugAppender]. Did you define it below instead of above in the configuration file?

18:10:51,650 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details.

18:10:51,650 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [infoAppender]. Did you define it below instead of above in the configuration file?

18:10:51,650 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details.

18:10:51,650 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [errorAppender]. Did you define it below instead of above in the configuration file?

18:10:51,650 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details.

18:10:51,650 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO

18:10:51,650 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - Could not find an appender named [consoleAppender]. Did you define it below instead of above in the configuration file?

18:10:51,650 |-ERROR in ch.qos.logback.core.joran.action.AppenderRefAction - See http://logback.qos.ch/codes.html#appender_order for more details.

18:10:51,650 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.

18:10:51,651 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@256216b3 - Registering current configuration as safe fallback point




老师,我写了日志打印的语句,而且程序也运行正常,但是就是没有日志信息?是因为导包错误吗?

正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,同学所说的没有日志信息是什么意思?在代码中使用logger.debug()输出了日志,但是在控制台没有打印日志信息。还是指日志文件中没有日志信息。

如果是使用logger.debug()输出了日志,但是在控制台没有打印,建议同学打上断点,使用debug的方式执行一下,查看是否有执行到logger.debug()这行代码。

如果是日志文件中没有日志,查看是否执行到对应级别的代码。比如debug.log,查看是否执行debug级别的代码。

祝:学习愉快~

  • 衮雪TripleRock 提问者 #1
    控制台没有输出
    2020-10-23 19:09:36
  • 好帮手慕阿满 回复 提问者 衮雪TripleRock #2
    同学你好,建议同学打上断点,使用debug的方式执行一下,查看是否有执行到logger.debug()这行代码。 祝:学习愉快~
    2020-10-24 10:02:16
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师