1 ERROR in ch.qos.logback.core.joran.spi.Interpreter@76:39 - no applicable action for [springProfile]
Connected to the target VM, address: '127.0.0.1:61435', transport: 'socket' 14:32:02,303 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 14:32:02,303 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 14:32:02,303 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/D:/code/git/mw/umc_file_service/target/classes/logback.xml] 14:32:02,357 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 14:32:02,360 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 14:32:02,363 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT] 14:32:02,366 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 14:32:02,396 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 14:32:02,398 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [errorFile] 14:32:02,402 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@800281454 - setting totalSizeCap to 128 MB 14:32:02,403 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@800281454 - Archive files will be limited to [20 MB] each. 14:32:02,405 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@800281454 - No compression will be used 14:32:02,406 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@800281454 - Will use the pattern logs/error.log.%d{yyyy-MM-dd}.%i for the active file 14:32:02,408 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@169e6180 - The date pattern is 'yyyy-MM-dd' from file name pattern 'logs/error.log.%d{yyyy-MM-dd}.%i'. 14:32:02,408 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@169e6180 - Roll-over at midnight. 14:32:02,409 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@169e6180 - Setting initial period to Tue Nov 16 14:19:31 CST 2021 14:32:02,411 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@800281454 - Cleaning on start up 14:32:02,420 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 14:32:02,420 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization 14:32:02,420 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start. 14:32:02,423 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[errorFile] - Active log file name: logs/error.log 14:32:02,423 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[errorFile] - File property is set to [logs/error.log] 14:32:02,424 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 14:32:02,424 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [allFile] 14:32:02,425 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@900636745 - setting totalSizeCap to 128 MB 14:32:02,425 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@900636745 - Archive files will be limited to [20 MB] each. 14:32:02,425 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@900636745 - No compression will be used 14:32:02,425 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@900636745 - Will use the pattern logs/all.log.%d{yyyy-MM-dd}.%i for the active file 14:32:02,426 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@7205765b - The date pattern is 'yyyy-MM-dd' from file name pattern 'logs/all.log.%d{yyyy-MM-dd}.%i'. 14:32:02,426 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@7205765b - Roll-over at midnight. 14:32:02,426 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@7205765b - Setting initial period to Tue Nov 16 14:19:31 CST 2021 14:32:02,426 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@900636745 - Cleaning on start up 14:32:02,427 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 14:32:02,427 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization 14:32:02,427 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start. 14:32:02,427 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[allFile] - Active log file name: logs/allFile.log 14:32:02,427 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[allFile] - File property is set to [logs/allFile.log] 14:32:02,427 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 14:32:02,427 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [uploadHistory] 14:32:02,428 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Removed 0 Bytes of files 14:32:02,428 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1201173334 - setting totalSizeCap to 128 MB 14:32:02,428 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1201173334 - Archive files will be limited to [20 MB] each. 14:32:02,428 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1201173334 - No compression will be used 14:32:02,428 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1201173334 - Will use the pattern logs/uploadHistory.log.%d{yyyy-MM-dd}.%i for the active file 14:32:02,429 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@22ef9844 - The date pattern is 'yyyy-MM-dd' from file name pattern 'logs/uploadHistory.log.%d{yyyy-MM-dd}.%i'. 14:32:02,429 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@22ef9844 - Roll-over at midnight. 14:32:02,429 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@22ef9844 - Setting initial period to Tue Nov 16 14:19:12 CST 2021 14:32:02,429 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1201173334 - Cleaning on start up 14:32:02,429 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - first clean up after appender initialization 14:32:02,429 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Multiple periods, i.e. 32 periods, seem to have elapsed. This is expected at application start. 14:32:02,429 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 14:32:02,429 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[uploadHistory] - Active log file name: logs/uploadHistory.log 14:32:02,429 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[uploadHistory] - File property is set to [logs/uploadHistory.log] 14:32:02,430 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [com.lk.umc.files.utils.LogUtil] to false 14:32:02,430 |-INFO in ch.qos.logback.classic.joran.action.LevelAction - com.lk.umc.files.utils.LogUtil level set to INFO 14:32:02,430 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [uploadHistory] to Logger[com.lk.umc.files.utils.LogUtil] 14:32:02,432 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Removed 0 Bytes of files 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@76:39 - no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]] 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@77:22 - no applicable action for [root], current ElementPath is [[configuration][springProfile][root]] 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@79:33 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]] 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@81:34 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]] 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@86:29 - no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]] 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@87:22 - no applicable action for [root], current ElementPath is [[configuration][springProfile][root]] 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@89:33 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]] 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@91:34 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]] 14:32:02,432 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@92:36 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]] 14:32:02,432 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 14:32:02,433 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6283d8b8 - Registering current configuration as safe fallback point 14:32:02,433 |-INFO in c.q.l.core.rolling.helper.TimeBasedArchiveRemover - Removed 0 Bytes of files 14:32:03.995 [main] INFO c.u.j.c.EnableEncryptablePropertiesBeanFactoryPostProcessor - Post-processing PropertySource instances 14:32:04.030 [main] INFO c.u.j.EncryptablePropertySourceConverter - Converting PropertySource configurationProperties [org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource] to AOP Proxy 14:32:04.031 [main] INFO c.u.j.EncryptablePropertySourceConverter - Converting PropertySource bootstrap [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 14:32:04.031 [main] INFO c.u.j.EncryptablePropertySourceConverter - Converting PropertySource systemProperties [org.springframework.core.env.PropertiesPropertySource] to EncryptableMapPropertySourceWrapper 14:32:04.031 [main] INFO c.u.j.EncryptablePropertySourceConverter - Converting PropertySource systemEnvironment [org.springframework.boot.env.SystemEnvironmentPropertySourceEnvironmentPostProcessor$OriginAwareSystemEnvironmentPropertySource] to EncryptableMapPropertySourceWrapper 14:32:04.031 [main] INFO c.u.j.EncryptablePropertySourceConverter - Converting PropertySource random [org.springframework.boot.env.RandomValuePropertySource] to EncryptablePropertySourceWrapper 14:32:04.031 [main] INFO c.u.j.EncryptablePropertySourceConverter - Converting PropertySource springCloudClientHostInfo [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper 14:32:04.031 [main] INFO c.u.j.EncryptablePropertySourceConverter - Converting PropertySource applicationConfig: [classpath:/bootstrap.properties] [org.springframework.boot.env.OriginTrackedMapPropertySource] to EncryptableMapPropertySourceWrapper 14:32:04.043 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$5d7b1854] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 14:32:04.060 [main] INFO c.u.j.f.DefaultLazyPropertyFilter - Property Filter custom Bean not found with name 'encryptablePropertyFilter'. Initializing Default Property Filter 14:32:04.063 [main] INFO c.u.j.r.DefaultLazyPropertyResolver - Property Resolver custom Bean not found with name 'encryptablePropertyResolver'. Initializing Default Property Resolver 14:32:04.063 [main] INFO c.u.j.d.DefaultLazyPropertyDetector - Property Detector custom Bean not found with name 'encryptablePropertyDetector'. Initializing Default Property Detector . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.3.2.RELEASE) infoEnabled = false isWarnEnabled = false isErrorEnabled = true debugEnabled = false
虽然呢, 没有任何影响也没有出现上面错误,但是感觉也是不太好。 怎么改? logback.xml 改成 logback-spring.xml 即可。。
https://blog.csdn.net/qq_33430083/article/details/91360771
2 无法打印info日志,而是一直是error日志, 只能看到错误日志, 即使修改本地的application.properties、 bootstrap.properties 都无效..
验证一下:
String name = log.getName();
System.out.println("name = " + name);
boolean infoEnabled = log.isInfoEnabled();
System.out.println("infoEnabled = " + infoEnabled);
infoEnabled = log.isWarnEnabled();
System.out.println("isWarnEnabled = " + infoEnabled);
infoEnabled = log.isErrorEnabled();
System.out.println("isErrorEnabled = " + infoEnabled);
boolean debugEnabled = log.isDebugEnabled();
System.out.println("debugEnabled = " + debugEnabled);
打印是:
name = com.tes.umc.files.controller.FileController
infoEnabled = true
isWarnEnabled = true
isErrorEnabled = true
debugEnabled = false
确实是这样, 郁闷了,搞了很久,结果发现是由于nacos 中存在两个 配置,
umc-fileserver.properties
umc-fileserver-prod.properties
其中umc-fileserver-prod.properties 配置的是error 级别。 系统启动参数是:spring.profiles.active=prod, 故而, 我修改umc-fileserver.properties 和本地的application.properties、 bootstrap.properties 都无效
nacos 是会加载默认配置文件umc-fileserver.properties的 , 即使指定了 spring.profiles.active=prod, 但是如果存在 umc-fileserver-prod.properties , 那么它优先级最高。
umc-fileserver.properties 是在 大概任何情况下都被读取的。
看来 umc-fileserver-prod.properties 的配置优先级最高!