tobr
tobr

Reputation: 127

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 with 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?

Upvotes: 1

Views: 1467

Answers (1)

tobr
tobr

Reputation: 127

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>

Upvotes: 2

Related Questions