-
Notifications
You must be signed in to change notification settings - Fork 16
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
logback-test.xml file in used library #22
Comments
Interesting - do you have some documentation on that? I also switched a project to logback recently and have troubles configuring the log outputs for testing... |
In fact, logback.groovy is the one with highehst priority. Documentation on the configuration bootstrapping is available here. |
logback.groovy however, requires additional groovy deps on the classpath. If you don't like to include them you may consider excluding all logback-test.xml files from your build. This should normally be the case when you place it under src/test/resources. Anyway, in certain eclipse setups (e.g. running your webapp with open submodules from eclipse) the src/test/resources folder will be part of the classpath and therefore pick the first logback-test.xml it finds. Otherwise we could remove all logback-test.xml files from modules to let the default config take over log configuration |
Self-maintained modules should not be the main issue here. logback-test.xml 2013/7/3 Henning Bredel notifications@github.com
Matthes Rieke http://52north.org/ General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk |
@matthesrieke so what is your suggestion here? Be sure to always have a logback.groovy in place to keep 3rd party logback-test.xml files being used? I personally find adding groovy dependencies may be a bit much footprint for just parsing an xml file ... |
I do not have a clean solution. Maybe post a request on the logback mailing list? |
Here's a nice discussion tackling this: http://jira.qos.ch/browse/LOGBACK-618 So, this issue is eclipse specific. However, you can specify the config file to be used via -D parameter: logback.configurationFile=/path/to/config.xml I added a note in the 52n logging good practice section |
Another solution might be to eclude any logback-test.xml from eclipse's classpath (might be a bit harsh but it is an eclipse only config where you might be ok with logback's default NoConfigLogger) : <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<phase>!test</phase>
<configuration>
<sourceExcludes>
<sourceExclude>**/logback-test.xml</sourceExclude>
</sourceExcludes>
</configuration>
</execution>
</executions>
</plugin> |
correct me if I am wrong, but wouldn't this also happen in a servlet container when there are multiple libs providing a logback-test.xml in their jars? Of course, it would be bad practice, but still might occur. I guess the SensorWebClient will then take that file as the configuration. |
Am 05.07.2013 14:49, schrieb Matthes Rieke:
You are right. This case can occur if logback-test.xml files are However, as far as I understand it this may also be the case if a Best Henning Henning Bredel |
Yap, I just checked the sources of logback. There is probably no absolutely clean way to work around this issue. One could define a different configuration file property (via |
I do not like hacking logback. Just using normal logback.xml entries and exclude logback-test.xml in an eclipse setup should be just fine. I see it as an issue of the 3rd party lib when it includes any logback configuration |
Exists a logback-test.xml file in one used library, it overrides the common logging properties.
The text was updated successfully, but these errors were encountered: