关于log4j:ERROR Attempted to append toclosed异常

本文介绍了一位同事遇到的Log4j配置错误问题:尝试向已关闭的追加器写入日志。通过排查发现,问题根源在于项目依赖中存在多个Log4j配置文件。文章建议检查项目的类路径是否存在多余的Log4j配置文件。
今天在某人的机器发现:

log4j:ERROR Attempted to append to closed appender named [A1].



他和我用相同的配置文件,我没有异常,而他有



经过排查,实际很简单,就是因为他的某个依赖工程有另外一个log4j.properties文件存在,导致了上述异常。



所以当你碰到类似的问题,请检查classpath是否还有其他的Log4j.properties文件。
摘自:http://blog.sina.com.cn/s/blog_58c679ff01009w7i.html
springaialibaba项目启动出现大量警告:16:00:24,057 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - 'File' option has the same value "C:\Users\Dai52/logs/nacos/config.log" as that given for appender [CONFIG_LOG_FILE] defined earlier. 16:00:24,058 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. 16:00:24,058 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - For more information, please visit https://logback.qos.ch/codes.html#earlier_fa_collision 16:00:24,059 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - 'File' option has the same value "C:\Users\Dai52/logs/nacos/naming.log" as that given for appender [NAMING_LOG_FILE] defined earlier. 16:00:24,059 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. 16:00:24,059 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - For more information, please visit https://logback.qos.ch/codes.html#earlier_fa_collision 16:00:24,060 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - 'File' option has the same value "C:\Users\Dai52/logs/nacos/remote.log" as that given for appender [REMOTE_LOG_FILE] defined earlier. 16:00:24,061 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. 16:00:24,061 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - For more information, please visit https://logback.qos.ch/codes.html#earlier_fa_collision 2025-05-28T16:00:24.067+08:00 INFO 23488 --- [SpringAI-ALibaba] [ main] com.dai.SpringAiAlibabaApplication : Starting SpringAiAlibabaApplication using Java 23.0.1 with PID 23488 (D:\JavaWeb\SpringAI-Alibaba\target\classes started by Dai52 in D:\JavaWeb\SpringAI-Alibaba) 2025-05-28T16:00:24.067+08:00 INFO 23488 --- [SpringAI-ALibaba] [ main] com.dai.SpringAiAlibabaApplication : No active profile set, falling back to 1 default profile: "default" 2025-05-28T16:00:24.684+08:00 WARN 23488 --- [SpringAI-ALibaba] [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.cloud.nacos.NacosConfigAutoConfiguration' of type [com.alibaba.cloud.nacos.NacosConfigAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [nacosAnnotationProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead. 2025-05-28T16:00:24.688+08:00 WARN 23488 --- [SpringAI-ALibaba] [ main] trationDelegate$BeanPostProcessorChecker : Bean 'nacosConfigProperties' of type [com.alibaba.cloud.nacos.NacosConfigProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [nacosAnnotationProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE. 16:00:24,695 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - 'File' option has the same value "C:\Users\Dai52/logs/nacos/config.log" as that given for appender [CONFIG_LOG_FILE] defined earlier. 16:00:24,695 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. 16:00:24,695 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - For more information, please visit https://logback.qos.ch/codes.html#earlier_fa_collision 16:00:24,696 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - 'File' option has the same value "C:\Users\Dai52/logs/nacos/naming.log" as that given for appender [NAMING_LOG_FILE] defined earlier. 16:00:24,696 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. 16:00:24,696 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - For more information, please visit https://logback.qos.ch/codes.html#earlier_fa_collision 16:00:24,697 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - 'File' option has the same value "C:\Users\Dai52/logs/nacos/remote.log" as that given for appender [REMOTE_LOG_FILE] defined earlier. 16:00:24,697 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. 16:00:24,697 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - For more information, please visit https://logback.qos.ch/codes.html#earlier_fa_collision 16:00:24,701 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Attempted to append to non started appender [CONFIG_LOG_FILE]. 16:00:24,701 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Attempted to append to non started appender [CONFIG_LOG_FILE]. 16:00:24,701 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Attempted to append to non started appender [CONFIG_LOG_FILE]. 16:00:24,701 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Attempted to append to non started appender [CONFIG_LOG_FILE]. 16:00:24,701 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Attempted to append to non started appender [CONFIG_LOG_FILE]. 16:00:24,701 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Attempted to append to non started appender [CONFIG_LOG_FILE]. 16:00:24,728 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Attempted to append to non started appender [REMOTE_LOG_FILE]. 16:00:24,729 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Attempted to append to non started appender [REMOTE_LOG_FILE]. 16:00:24,729 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Attempted to append to non started appender [REMOTE_LOG_FILE]. 16:00:24,729 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Attempted to append to non started appender [REMOTE_LOG_FILE]. 16:00:24,729 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Attempted to append to non started appender [REMOTE_LOG_FILE]. 16:00:24,729 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Attempted to append to non started appender [REMOTE_LOG_FILE].
05-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值