title: coudnt use logback because of log4j
body: <p>Hi i have problems with logback and slf4j, im writing simple app that later is packaging in jar and i want to add there logging using logback</p>
  
  <p>im using:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;1.7.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
          &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
          &lt;version&gt;1.1.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
          &lt;artifactId&gt;logback-core&lt;/artifactId&gt;
          &lt;version&gt;1.1.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.activemq&lt;/groupId&gt;
          &lt;artifactId&gt;activemq-client&lt;/artifactId&gt;
          &lt;version&gt;5.8.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.mchange&lt;/groupId&gt;
          &lt;artifactId&gt;c3p0&lt;/artifactId&gt;
          &lt;version&gt;${c3p0.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-pool&lt;/groupId&gt;
          &lt;artifactId&gt;commons-pool&lt;/artifactId&gt;
          &lt;version&gt;${commons.pool.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;postgresql&lt;/groupId&gt;
          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;version&gt;${postgresql.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.sf.ehcache&lt;/groupId&gt;
          &lt;artifactId&gt;ehcache&lt;/artifactId&gt;
          &lt;version&gt;${ehcache.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
          &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;version&gt;${gson.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;redis.clients&lt;/groupId&gt;
          &lt;artifactId&gt;jedis&lt;/artifactId&gt;
          &lt;version&gt;${jedis.version}&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>in Main i have:</p>
  
  <pre><code>LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
  JoranConfigurator configurator = new JoranConfigurator();
  configurator.setContext(loggerContext);
  configurator.doConfigure(logbackFile)
  </code></pre>
  
  <p>it used for load logback.xml configuration outside of jar file</p>
  
  <p>The funniest thing is that this program is working on local machine (Windows) (reading logback.xml, create file, write to file) but when i upload it to remote  server (linux) i have strange error</p>
  
  <pre><code>Exception in thread "main" java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
  </code></pre>
  
  <p>the question is why he want to cast ch.qos.logback.classic.LoggerContext from org.slf4j.impl.<strong>Log4jLoggerFactory</strong>??</p>
  
  <p>I dont have anywhere any lib of log4j... i mean i dont have it on entire machine</p>
  
  <p>one additional info:
  on Windows i have Java from Oracle and on Linux i have openjdk - it can be a problem?</p>
  
  <p>//=================dependency tree</p>
  
  <pre><code>[INFO] +- org.apache.activemq:activemq-client:jar:5.8.0:compile
  [INFO] |  +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
  [INFO] |  +- org.fusesource.hawtbuf:hawtbuf:jar:1.9:compile
  [INFO] |  \- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:compile
  [INFO] +- com.mchange:c3p0:jar:0.9.2-pre6:compile
  [INFO] |  \- com.mchange:mchange-commons-java:jar:0.2.3.1:compile
  [INFO] +- commons-pool:commons-pool:jar:1.6:compile
  [INFO] +- postgresql:postgresql:jar:9.1-901.jdbc4:compile
  [INFO] +- net.sf.ehcache:ehcache:jar:2.9.0:compile
  [INFO] +- com.google.code.gson:gson:jar:2.2.4:compile
  [INFO] +- redis.clients:jedis:jar:2.1.0:compile
  [INFO] +- org.slf4j:slf4j-api:jar:1.7.5:compile
  [INFO] +- ch.qos.logback:logback-classic:jar:1.1.3:compile
  [INFO] +- ch.qos.logback:logback-core:jar:1.1.3:compile
  [INFO] \- junit:junit:jar:4.11:test
  [INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test
  </code></pre>