add alibaba-nacos-config dependency throw Exception about nacos and logback

See original GitHub issue

When I add the following dependency in my springboot project, I ran out of exception:

add config center dependency <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency>

[18:44:54.626] main ERROR o.s.b.SpringApplication - reportFailure,834 - Application run failed java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - ‘File’ option has the same value “/logs/nacos/config.log” as that given for appender [CONFIG_LOG_FILE] defined earlier. ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. ERROR in ch.qos.logback.core.rolling.RollingFileAppender[CONFIG_LOG_FILE] - For more information, please visit http://logback.qos.ch/codes.html#earlier_fa_collision ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - ‘File’ option has the same value “/logs/nacos/naming.log” as that given for appender [NAMING_LOG_FILE] defined earlier. ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. ERROR in ch.qos.logback.core.rolling.RollingFileAppender[NAMING_LOG_FILE] - For more information, please visit http://logback.qos.ch/codes.html#earlier_fa_collision ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - ‘File’ option has the same value “/logs/nacos/remote.log” as that given for appender [REMOTE_LOG_FILE] defined earlier. ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - Collisions detected with FileAppender/RollingAppender instances defined earlier. Aborting. ERROR in ch.qos.logback.core.rolling.RollingFileAppender[REMOTE_LOG_FILE] - For more information, please visit http://logback.qos.ch/codes.html#earlier_fa_collision at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:321) at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:281) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:216) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:80) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:342) at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1247) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1236) at com.finger.Application.main(Application.java:20)

my springboot version:2.3.12,spring cloud version:Hoxton.SR12,cloud alibaba:2.2.8.RELEASE

my logback.xml like this:

<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="60 seconds" debug="false"> <property name="log.path" value="/logs/fingernft-admin-farm" /> <property name="log.pattern" value="[%d{HH:mm:ss.SSS}] %thread %-5level %logger{20} - %method,%line - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
	<encoder>
		<pattern>${log.pattern}</pattern>
	</encoder>
</appender>

<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${log.path}/info.log</file>
    <!-- 循环政策:基于时间创建日志文件 -->
	<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <!-- 日志文件名格式 -->
		<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
		<!-- 日志最大的历史 60天 -->
		<maxHistory>60</maxHistory>
	</rollingPolicy>
	<encoder>
		<pattern>${log.pattern}</pattern>
	</encoder>
	<filter class="ch.qos.logback.classic.filter.LevelFilter">
        <!-- 过滤的级别 -->
        <level>INFO</level>
        <!-- 匹配时的操作:接收(记录) -->
        <onMatch>ACCEPT</onMatch>
        <!-- 不匹配时的操作:拒绝(不记录) -->
        <onMismatch>DENY</onMismatch>
    </filter>
</appender>

<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${log.path}/error.log</file>
    <!-- 循环政策:基于时间创建日志文件 -->
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <!-- 日志文件名格式 -->
        <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
		<!-- 日志最大的历史 60天 -->
		<maxHistory>60</maxHistory>
    </rollingPolicy>
    <encoder>
        <pattern>${log.pattern}</pattern>
    </encoder>
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
        <!-- 过滤的级别 -->
        <level>ERROR</level>
		<!-- 匹配时的操作:接收(记录) -->
        <onMatch>ACCEPT</onMatch>
		<!-- 不匹配时的操作:拒绝(不记录) -->
        <onMismatch>DENY</onMismatch>
    </filter>
</appender>

<!-- 系统模块日志级别控制  -->
<logger name="com.finger" level="info" />
<!-- Spring日志级别控制  -->
<logger name="org.springframework" level="warn" />

<root level="info">
	<appender-ref ref="console" />
</root>

<!--系统操作日志-->
<root level="info">
    <appender-ref ref="file_info" />
    <appender-ref ref="file_error" />
</root>
</configuration>

so, what happends?

thanks for replay!!appreciate!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
pigercccommented, Aug 3, 2022

i have the same issue add below args,maybe solve this

-Dnacos.logging.default.config.enabled=false
0reactions
GOODBOY008commented, Sep 14, 2022

@yuhuangbin @GeneralLHW Please refer this issue https://github.com/alibaba/nacos/issues/8505 . It’s nacos bug and had fixed in feature version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alibaba Cloud Application Configuration Management
recommend that you use spring-cloud-starter-alibaba-nacos-config from Nacos instead. ... public static void main(String[] args) throws Exception {.
Read more >
FileNotFound exception thrown for logback config after ...
I think this is mainly caused because you filter out the logback.xml in your pom. Either: <resource> <directory>src/main/config</directory> ...
Read more >
全网最新的nacos 2.1.0集群多节点部署教程 - Candyメ奶糖
exception.NacosException: Nacos Server did not start because dumpservice bean construction failure : No DataSource set at com.alibaba.nacos.
Read more >
Logging Exceptions Using SLF4J - Baeldung
Quick overview of exception logging with SLF4J logging abstraction. ... First, we need to add the following dependencies to our pom.xml:
Read more >
Nacos is really fragrant, learn from zero to one - iDiTect
1. Add the following dependencies to the configuration file: <dependency>; <groupid>com.alibaba.cloud</groupid>; <artifactid>spring-cloud-starter- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found