when I try to use spring boot default configuration to configure a rolling log files,logback show tips like title,so I view source(v2.2.6.RELEASE) to find the reason. in 150 lines of DefaultLogbackConfiguration.java,
private void setRollingPolicy(RollingFileAppender<ILoggingEvent> appender, LogbackConfigurator config,
String logFile) {
SizeAndTimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new SizeAndTimeBasedRollingPolicy<>();
...
rollingPolicy.setTotalSizeCap(new FileSize(totalSizeCap.toBytes()));
appender.setRollingPolicy(rollingPolicy);
...
}
when then rollingPolicy setRollingPolicy,logback show this tips,the tips info in 74 line of ContextAwareBase.java,the problem is not serious but very vexed, please repair it as soon as possible,thanks!
Comment From: wilkinsona
Thanks for the report. I haven't seen Logback output LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy
when using Boot's default logging configuration. Can you please provide a small sample that reproduces this behaviour so that we can investigate? You can a provide a sample by zipping it up and attaching it to this issue or by pushing it to a separate repository.
Comment From: bauline
Thanks for the report. I haven't seen Logback output
LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy
when using Boot's default logging configuration. Can you please provide a small sample that reproduces this behaviour so that we can investigate? You can a provide a sample by zipping it up and attaching it to this issue or by pushing it to a separate repository.
Comment From: wilkinsona
Thanks. I've reproduced the problem.
Comment From: Drezir
I can confirm this problem too.
Comment From: bauline
I can confirm this problem too.
It just a tips,If you don't want to see this information you can put a logback-spring.xml into classpath.
Comment From: kamaci
Here is a question of me related to the same issue: https://stackoverflow.com/questions/60934273/spring-boot-2-2-6-no-context-given-for-sizeandtimebasedrollingpolicy-at-logback
Comment From: Fantaztig
Does anyone know when this was first introduced?
Comment From: Hlingoes
I can confirm this problem. Change SizeAndTimeBasedRollingPolicy.java
to TimeBasedRollingPolicy.java
can fix the warning. I found logback自定义logger的java代码 works well, but logback运行时动态创建日志文件 show the problem. My springboot version is 2.0.1.RELEASE. Waiting for the good news.
Comment From: Fantaztig
@Hlingoes interesting, we never had this problem before 2.2.X, running some microservices with 2.1.7 without any issues.
Comment From: jaadlani
I can confirm this problem too, with spring boot : 2.2.8.RELEASE version
Comment From: jeanemvista
Same problem with SpringBoot v2.2.7.RELEASE :
LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@768185844
Comment From: wilkinsona
Thanks everyone. We’ve already reproduced the problem and just need the time to fix it. In the meantime there’s no need to confirm that it occurs.
Comment From: besserer
Alguna solución con este tema pendiente???
Comment From: snicoll
@besserer the issue was fixed in 2.2.9
so please upgrade to that.
Comment From: greedyaj
@snicoll , I am facing this issue with console appender, getting below messages LOGBACK: No context given for ch.qos.logback.core.spi.ContextAwareBase@4f880e48 LOGBACK: No context given for ch.qos.logback.core.spi.ContextAwareBase@4a7d5552
Comment From: wilkinsona
@greedyaj That doesn't sounds like the same problem as this issue was specific to SizeAndTimeBasedRollingPolicy
. If you believe you've found a bug please open a new issue with a minimal sample that reproduces the problem.
Comment From: greedyaj
@wilkinsona Created new issue https://github.com/spring-projects/spring-boot/issues/27729 Please check.