gpt4 book ai didi

java - 更改 Tomcat 的日志级别不起作用

转载 作者:行者123 更新时间:2023-11-28 23:23:35 34 4
gpt4 key购买 nike

我正在尝试在 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

有什么线索吗?我知道这个错误可能很愚蠢,但我已经花了很长时间寻找答案 ;) 谢谢 :)

最佳答案

我在属性文件中没有看到任何会故意启用调试级别日志记录的内容。建议您返回到您的 catalina.out 文件并验证 log4j.properties 文件在启动时被解析且没有错误。还要查看 CATALINA_HOME/conf 文件夹中的 logging.properties 文件,并验证那里的所有日志记录都处于 CONFIG 或更低级别。

关于java - 更改 Tomcat 的日志级别不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39890415/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com