In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to deal with the problem of printing Debug information in the log4j configuration failure log. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Print Debug information in log4j configuration failure log
Recently, when I released the project, I found that the console printed a lot more logs than usual. if you take a closer look, the debug and info information are also listed. Open the log4j.xml configuration file and have a look:
Configuration is error level, obviously should not appear debug information, must be the configuration file does not work, what is the reason?
Check the data to find an explanation: Log4j and logback conflict, which will cause the log level of Log4j to be reduced to the DEBUG level.
The project uses log4j instead of logback, so does it rely on implicitly joining logback? If you turn on the dependency, you can see that there is a logback:
Knowing why, remove logback from the maven dependency.
The method of removing dependence
1. Change to the dependency where logback is introduced, as shown in the figure, right-> Jump To Source
two。 Eliminate logback dependencies
Configuration of com.weimob.saas.foundationwxbase-core-service-client1.3.2-SNAPSHOTch.qos.logbacklogback-classicch.qos.logbacklogback-corelog4j logs-Debug## logger definition # # Log output level OFF, DEBUG, INFO, WARN, ERRORlog4j.rootLogger = DEBUG ConsoleAppender,debug,info,warn Error## log output controller definition # # root logger console output controller log4j.appender.consoleAppender = org.apache.log4j.ConsoleAppenderlog4j.appender.consoleAppender.Target = System.outlog4j.appender.consoleAppender.layout = org. Apache.log4j.PatternLayoutlog4j.appender.consoleAppender.layout.ConversionPattern =%-d {yyyy-MM-dd HH\: mm\: ss} -% C [% t\:% r]-[% p]% m%n# root logger file output controller DEBUGlog4j.logger.debug=debuglog4j.appender.debug = org.apache.log4j.RollingFileAppenderlog4j.appender.debug.encoding=UTF-8log4j.appender.debug.File = E:\\ tomcat-8.5.16-x86\\ mylog\\ debug. Loglog4j.appender.debug.Append = truelog4j.appender.debug.Threshold = DEBUGlog4j.appender.debug.MaxFileSize=900KBlog4j.appender.debug.MaxBackupIndex=1log4j.appender.debug.layout = org.apache.log4j.PatternLayoutlog4j.appender.debug.layout.ConversionPattern =%-d {yyyy-MM-dd HH\: mm\: ss} -% C [% t\:% r]-[% p]% m%n# root logger file output controller INFOlog4j.logger.info=infolog4j.appender.info = org.apache .log4j.RollingFileAppenderlog4j.appender.info.encoding=UTF-8log4j.appender.info.File = E:\\ tomcat-8.5.16-x86\\ mylog\\ info.loglog4j.appender.info.Append = truelog4j.appender.info.Threshold = INFOlog4j.appender.info.MaxFileSize=900KBlog4j.appender.info.MaxBackupIndex=1log4j.appender.info.layout = org.apache.log4j.PatternLayoutlog4j.appender.info.layout.ConversionPattern =%-d {yyyy-MM-dd HH\: mm\: ss} -% C [% t\:% r] -[% p]% m%n# root logger file output controller WARNlog4j.logger.warn=warnlog4j.appender.warn = org.apache.log4j.RollingFileAppenderlog4j.appender.warn.encoding=UTF-8log4j.appender.warn.File = E:\\ tomcat-8.5.16-x86\\ mylog\\ warn.loglog4j.appender.warn.Append = truelog4j.appender.warn.Threshold = WARNlog4j.appender.warn.MaxFileSize=900KBlog4j.appender.warn.MaxBackupIndex=1log4j.appender.warn.layout = org.apache.log4j.PatternLayoutlog4j. Appender.warn.layout.ConversionPattern =%-d {yyyy-MM-dd HH\: mm\: ss} -% C [% t\:% r]-[% p]% m%n# root logger file output controller ERRORlog4j.logger.error=errorlog4j.appender.error = org.apache.log4j.RollingFileAppenderlog4j.appender.error.encoding=UTF-8log4j.appender.error.File = E:\\ tomcat-8.5.16-x86\\ mylog\\ error.loglog4j.appender.error. Append = truelog4j.appender.error.Threshold = ERRORlog4j.appender.error.MaxFileSize=900KBlog4j.appender.error.MaxBackupIndex=1log4j.appender.error.layout = org.apache.log4j.PatternLayoutlog4j.appender.error.layout.ConversionPattern =%-d {yyyy-MM-dd HH\: mm\: ss} -% C [% t\:% r]-[% p]% m% nHow to deal with the problem of printing Debug information in the log4j configuration failure log Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.