SpringBoot集成日志logback.groovy报错: Groovy classes are not available on the class path. ABORTING INITIALIZATION.
来源:互联网 发布:单例模式 java csdn 编辑:程序博客网 时间:2024/06/01 08:46
问题描述
SpringBoot集成日志logback.groovy报错: Groovy classes are not available on the class path. ABORTING INITIALIZATION.
logback.groovy配置文件内容如下:
//https://logback.qos.ch/translator/asGroovy.htmlimport ch.qos.logback.classic.encoder.PatternLayoutEncoderimport ch.qos.logback.classic.filter.ThresholdFilterimport ch.qos.logback.core.ConsoleAppenderimport ch.qos.logback.core.rolling.RollingFileAppenderimport ch.qos.logback.core.rolling.TimeBasedRollingPolicyimport java.nio.charset.Charsetimport static ch.qos.logback.classic.Level.*def USER_HOME = System.getProperty("user.home")def APP_NAME = "lightsword"scan("60 seconds")context.name = "${APP_NAME}"jmxConfigurator()logger("org.springframework.web", INFO)logger("com.springboot.in.action", TRACE)logger("org.apache.velocity.runtime.log", INFO)appender("CONSOLE", ConsoleAppender) { encoder(PatternLayoutEncoder) { pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg %n" charset = Charset.forName("utf8") }}appender("dailyRollingFileAppender", RollingFileAppender) { file = "${USER_HOME}/logs/${APP_NAME}" rollingPolicy(TimeBasedRollingPolicy) { fileNamePattern = "${APP_NAME}.%d{yyyy-MM-dd}.log" maxHistory = 30 } filter(ThresholdFilter) { level = ERROR } encoder(PatternLayoutEncoder) { pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg %n" }}root(DEBUG, ["CONSOLE", "dailyRollingFileAppender"])
详细日志如下:
ERROR in ch.qos.logback.classic.LoggerContext[default] - Groovy classes are not available on the class path. ABORTING INITIALIZATION. at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:311) at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:272) at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:235) at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:208) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:72) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:338) at org.springframework.boot.SpringApplication.run(SpringApplication.java:309) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1187) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1176) at com.springboot.in.action.LightSwordApplication$.delayedEndpoint$com$springboot$in$action$LightSwordApplication$1(LightSwordApplication.scala:6) at com.springboot.in.action.LightSwordApplication$delayedInit$body.apply(LightSwordApplication.scala:5) at scala.Function0.apply$mcV$sp(Function0.scala:34) at scala.Function0.apply$mcV$sp$(Function0.scala:34) at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) at scala.App.$anonfun$main$1$adapted(App.scala:76) at scala.App$$Lambda$5/1451043227.apply(Unknown Source) at scala.collection.immutable.List.foreach(List.scala:389) at scala.App.main(App.scala:76) at scala.App.main$(App.scala:74) at com.springboot.in.action.LightSwordApplication$.main(LightSwordApplication.scala:5) at com.springboot.in.action.LightSwordApplication.main(LightSwordApplication.scala) ... 6 moreCaused by: java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.classic.LoggerContext[default] - Groovy classes are not available on the class path. ABORTING INITIALIZATION. at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:161) at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:57) at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:47)
原因分析
在类路径中没有Groovy类。
解决方案
项目中添加groovy依赖:
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all --> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>${groovy.version}</version> </dependency>
阅读全文
0 0
- SpringBoot集成日志logback.groovy报错: Groovy classes are not available on the class path. ABORTING INITIALIZATION.
- Bitmap Font 报错“characters from the file are not available in the font”解决办法
- Springboot+logback集成ELK处理日志实例
- 《Groovy极简教程》第5章 SpringBoot集成Groovy与Java混合编程
- elasticsearch报错:None of the configured nodes are available: []
- groovy
- groovy
- Groovy
- Groovy
- Groovy
- groovy
- groovy
- Groovy
- Groovy
- Groovy
- Groovy
- groovy
- Groovy
- WebDriver API 大全
- Scala混用Java的集合类调用scala的foreach遍历问题
- Spring Boot集成Security使用数据库用户角色权限用户名问题
- Spring Boot集成Security使用数据库用户角色权限ROLE_问题
- SpringBoot集成logback.xml日志配置文件找不到错误
- SpringBoot集成日志logback.groovy报错: Groovy classes are not available on the class path. ABORTING INITIALIZATION.
- php学习笔记---变量和常量
- 远程调试 Android 设备使用入门
- Xposed: 勾住(Hook) Android应用程序对象的方法,实现AOP
- eclipse 无法解析导入 javax.servlet 的解决方法
- java反射例子
- xposed框架的Android网络监测模块
- Gradle+CMake构建Android Native项目
- Android.Hook框架xposed篇