我目前觀察到第三方庫(即javax.mail)使用java.util.logging。 javaMail的版本是1.4.7。 我想使用SLF4J LoggingFramwork來橋接JUL到logback。 的SLF4J API版本是:的logback核| 1.0.13
SLF4J的API | 1.7.5
七月到SLF4J | 1.7.5
使用SLF4J橋樑JUL does not無效
在主函數中,我還安裝SLF4JBridgeHandler以編程方式調用:
// Optionally remove existing handlers attached to j.u.l root logger
SLF4JBridgeHandler.removeHandlersForRootLogger();
// add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
// the initialization phase of your application
SLF4JBridgeHandler.install();
但它沒有網絡,javaMail還在我的控制檯中記錄調試信息。我的logbak.xml是
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
有什麼問題嗎?
在我的環境中,javaMail調試可能會啓用默認值。我怎樣才能關閉日誌? – smart 2014-11-05 13:20:22
查看最新的答案。 – jmehrens 2014-11-05 15:06:33
java.util.logging.Logger.getLogger(「javax.mail」)。setLevel(Level.WARNING);命令不起作用。請讓我忘記細節。我使用的是org.springframework.mail.javamail.JavaMailSenderImpl,它使用javaMail在掛鉤下發送Email.Does會影響日誌嗎? – smart 2014-11-06 01:21:41