I get the error on the title: LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1162810564
I get it with spring boot application's latest version after I added: logging.file.name =src/main/resources/logs/spring advance.log to the application.properties which is working fine I just can not understand why and what does Logback mean and if this is an error/warning? and how to fix it?
If I do not save the log to log file and only print it on the console I do not get this error
This is my full application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/example?
createDatabaseIfNotExist=true&serverTimezone=IST
spring.datasource.username=root
spring.datasource.password=1234
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#Hibernate/Jpa Configuration:
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
#spring.jpa.properties.hibernate.show_sql:true
#spring.jpa.properties.hibernate.format_sql=true
#Log Configuration:
logging.file.name =src/main/resources/logs/spring advance.log
#•Show Sql Statement:
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type=TRACE
#•Show Sql Values:
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} - %msg%n
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} - %msg%n
#Server Port Configuration:
server.port=8080
Added logback-spring.xml in resources folder fixed the issue for me. The content of the XML file can be found at https://docs.spring.io/spring-boot/docs/1.5.x/reference/html/howto-logging.html.
you should include xml config file and point to it in your application.properties
logging.config=classpath:config/logback-spring.xml
and here is the config file i used:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration>
<configuration scan="true">
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="javax.activation" level="WARN"/>
<logger name="javax.mail" level="WARN"/>
<logger name="javax.management.remote" level="WARN"/>
<logger name="javax.xml.bind" level="WARN"/>
<logger name="ch.qos.logback" level="WARN"/>
<logger name="com.codahale.metrics" level="WARN"/>
<logger name="com.ryantenney" level="WARN"/>
<logger name="com.sun" level="WARN"/>
<logger name="com.zaxxer" level="WARN"/>
<logger name="io.undertow" level="WARN"/>
<logger name="io.undertow.websockets.jsr" level="ERROR"/>
<logger name="org.ehcache" level="WARN"/>
<logger name="org.apache" level="WARN"/>
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
<logger name="org.bson" level="WARN"/>
<logger name="org.hibernate.validator" level="WARN"/>
<logger name="org.hibernate" level="WARN"/>
<logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
<logger name="org.springframework" level="WARN"/>
<logger name="org.springframework.web" level="WARN"/>
<logger name="org.springframework.security" level="WARN"/>
<logger name="org.springframework.cache" level="WARN"/>
<logger name="org.thymeleaf" level="WARN"/>
<logger name="org.xnio" level="WARN"/>
<logger name="springfox" level="WARN"/>
<logger name="sun.rmi" level="WARN"/>
<logger name="liquibase" level="WARN"/>
<logger name="LiquibaseSchemaResolver" level="INFO"/>
<logger name="sun.rmi.transport" level="WARN"/>
<!-- https://logback.qos.ch/manual/configuration.html#shutdownHook and https://jira.qos.ch/browse/LOGBACK-1090 -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
</configuration>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With