Solr logging with Logback
I try to log the solr output with logback. Using maven I build a new webapp and excluded any references to commons-logging and slf4j-jdk14 e.g.
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
<version>3.3</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-jdk14</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
I ended up wi开发者_如何学Pythonth no dependencies to any other logging framework but solr still logs to standard out:
12.07.2011 16:43:31 org.apache.solr.servlet.SolrDispatchFilter init
INFO: SolrDispatchFilter.init()
12.07.2011 16:43:31 org.apache.solr.core.SolrResourceLoader locateSolrHome
Has anyone any suggestions?
There was a hidden (masked) dependency of an older version of slf4j on an other dependency used by an other library. In my case it was netcdf used by apache tika. I excluded that dependency on tika and now solr uses logback for logging.
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>${tika.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>netcdf</artifactId>
<groupId>edu.ucar</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>edu.ucar</groupId>
<artifactId>netcdf</artifactId>
<version>4.2-min</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
精彩评论