-
Notifications
You must be signed in to change notification settings - Fork 40.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of logback.groovy results in double output. #1091
Comments
Works for me. How about a little sample project? |
No response? |
I had a similar issue today with Spring Boot (v1.1.5.RELEASE) causing double log output. It turns out My workaround was to rename
|
A pull request at https://github.com/spring-projects/spring-boot-issues with a sample project would still be very helpful. |
I created a test example project at: https://github.com/faroe228/spring-boot-issues/tree/master/gh-1091-groovy-logback |
Another observation: renaming logback.groovy to logback-test.groovy also works properly for Spring Boot (v1.1.5.RELEASE) and there is no need to update the application.properties file. |
The The first invocation comes from logback itself:
The second is from our custom log initialization:
I don't see duplicate log entries in the output but one thing that we could try is calling |
Could you try the latest snapshots to see if you can reproduce the double output error. I've also merge Cheers. |
Phil, I was unable to recreate the double logging output issue (reported by PeterNSteinmetz) with either of these versions: 1.1.5.RELEASE or 1.2.0.BUILD-SNAPSHOT) using the spring-boot gradle plugin - however double file appenders are still being created because of the double execution of logback.groovy. In the test example I submitted ( https://github.com/faroe228/spring-boot-issues/tree/master/gh-1091-groovy-logback ) one can see that two log files are created (in the log folder - one for each appender). It appears the first log file is never actually appended too (size remains zero). I also experimented with having the two different file appender instances (created by double execution of logback.groovy) to write to the same log file and there was no double output (even with the prudent property of the file appender set to true or false). I'm guessing the double execution of logback.groovy for most situations does little harm. For the hopefully rare cases when double execution of logback.groovy would create an issue there is at least a workaround by not using the default name of logback.groovy for the logback configuration file. Laurence Toenjes |
I've reopened this to take another look, but I think it's too risky to change the logging infrastructure at this stage in the 1.1.x line. I'll target this for 1.2 and we will have to leave it as a known issue in 1.1.x. |
Was dealing with this issue today and seemed to be more of a logback appender additivity issue. Once I set the additivity flag to |
@davetownsend Thanks for the info! |
Update LoggingSystems so that they can reinitialize themselves before logging begins. This allows reset of the root logger (which may have been set to OFF in beforeInitialize) and also re-evaluation of systems properties such as PID which may not have been set when logging configuration was first loaded. This commit may possibly reintroduce gh-1091, but it seems like reloading is our only option. Fixes gh-2125
If one replaces logback.xml with a logback.groovy file and eliminates the logback.xml file, the program produces two copies of each log item.
It is as though there are two appenders created. Seems likely spring-boot is not checking for logback.groovy to suppress its own logging configuration, as it does with logback.xml.
This is with 1.1.1-RELEASE.
The text was updated successfully, but these errors were encountered: