我正在尝试在Tomcat上配置Log4j,所以这是我的配置:
# Root logger option
log4j.rootLogger=INFO, stdout
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
log4j.logger.com.ibatis=INFO
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=INFO
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=INFO
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=INFO
log4j.logger.java.sql=INFO
log4j.logger.java.sql.Connection=INFO
log4j.logger.java.sql.Statement=INFO
log4j.logger.java.sql.PreparedStatement=INFO
log4j.logger.java.sql.ResultSet=INFO
# Thymeleaf logger
log4j.logger.org.thymeleaf=ERROR
log4j.logger.org.thymeleaf.TemplateEngine.CONFIG=ERROR
log4j.logger.org.thymeleaf.TemplateEngine.TIMER=ERROR
log4j.logger.org.thymeleaf.TemplateEngine.PARSERCACHE=ERROR
我希望只有日志的信息级别,并且Thymeleaf配置为仅显示错误。但我仍然在catalina.out中获取此信息:
00:43:44.591 [http-bio-8080-exec-2] DEBUG o.s.o.jpa.EntityManagerFactoryUtils - Closing JPA EntityManager
00:43:44.591 [http-bio-8080-exec-2] DEBUG c.p.app.interceptors.UserInterceptor - ================= addToModelUserDetails ============================
00:43:44.593 [http-bio-8080-exec-2] DEBUG c.p.app.interceptors.UserInterceptor - ================= addToModelUserDetails ============================
00:43:44.593 [http-bio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - Rendering view [org.thymeleaf.spring4.view.ThymeleafView@2874f679] in DispatcherServlet with name 'dispatcher'
00:43:44.593 [http-bio-8080-exec-2] DEBUG org.thymeleaf.TemplateEngine - [THYMELEAF][http-bio-8080-exec-2] STARTING PROCESS OF TEMPLATE "dashboard/index" WITH LOCALE pl_PL
00:43:44.594 [http-bio-8080-exec-2] DEBUG org.thymeleaf.TemplateRepository - [THYMELEAF][http-bio-8080-exec-2] Template "dashboard/index" was correctly resolved as resource "/WEB-INF/pages/dashboard/index.html" in mode LEGACYHTML5 with resource resolver "SERVLETCONTEXT"
00:43:44.610 [http-bio-8080-exec-2] DEBUG org.thymeleaf.TemplateEngine - [THYMELEAF][http-bio-8080-exec-2] Starting process on template "dashboard/index" using mode "LEGACYHTML5"
00:43:44.610 [http-bio-8080-exec-2] DEBUG org.thymeleaf.TemplateRepository - [THYMELEAF][http-bio-8080-exec-2] Template "template/template" was correctly resolved as resource "/WEB-INF/pages/template/template.html" in mode LEGACYHTML5 with resource resolver "SERVLETCONTEXT"
00:43:44.625 [http-bio-8080-exec-2] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler#0'
00:43:44.625 [http-bio-8080-exec-2] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler#0'
00:43:44.625 [http-bio-8080-exec-2] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler#0'
00:43:44.626 [http-bio-8080-exec-2] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler#0'
00:43:44.663 [http-bio-8080-exec-2] DEBUG org.thymeleaf.TemplateEngine - [THYMELEAF][http-bio-8080-exec-2] Finished process on template "dashboard/index" using mode "LEGACYHTML5"
00:43:44.674 [http-bio-8080-exec-2] DEBUG org.thymeleaf.TemplateEngine - [THYMELEAF][http-bio-8080-exec-2] FINISHED PROCESS AND OUTPUT OF TEMPLATE "dashboard/index" WITH LOCALE pl_PL
00:43:44.674 [http-bio-8080-exec-2] DEBUG org.thymeleaf.TemplateEngine.TIMER - [THYMELEAF][http-bio-8080-exec-2][dashboard/index][pl_PL][80456234][80] TEMPLATE "dashboard/index" WITH LOCALE pl_PL PROCESSED IN 80456234 nanoseconds (approx. 80ms)
00:43:44.674 [http-bio-8080-exec-2] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
00:43:44.678 [http-bio-8080-exec-2] DEBUG o.s.s.w.a.ExceptionTranslationFilter - Chain processed normally
00:43:44.678 [http-bio-8080-exec-2] DEBUG o.s.s.w.c.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed
有任何线索吗?我知道这个错误可能非常愚蠢,但我很长时间都在寻找答案;)谢谢:)。
答案 0 :(得分:0)
我没有在属性文件中看到有意启用调试级别日志记录的任何内容。建议您返回到catalina.out文件并验证是否在启动时解析了log4j.properties文件而没有错误。还要查看CATALINA_HOME / conf文件夹中的logging.properties文件,并验证其中所有日志记录的级别是CONFIG或更低。