title: Redirect java.util.logging to log4j
body: <p>I'm using an external JAR library that creates a log file every time is used:</p>
  
  <pre><code>   private void initLogger() {
          try {
              boolean var1 = true;
              FileHandler var2 = new FileHandler("lib.log", 4096000, 1, var1);
              var2.setFormatter(new SimpleFormatter());
              this.logger = Logger.getLogger("POS");
              this.logger.addHandler(var2);
          } catch (IOException var3) {
              var3.printStackTrace();
          }
      }
  </code></pre>
  
  <p>This, create the files <strong>lib.log</strong> , <strong>lib.log.lck</strong>, etc...</p>
  
  <p>The problem is that my App is using log4j(from maven xml):</p>
  
  <pre><code>&lt;!-- https://mvnrepository.com/artifact/log4j/log4j --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>What I want is simple, I want to redirect all the calls of that lib log to my logger.</p>
  
  <p>I've tried using <strong>jul-to-slf4j</strong> : </p>
  
  <p><a href="https://www.slf4j.org/legacy.html" rel="nofollow noreferrer">https://www.slf4j.org/legacy.html</a></p>
  
  <pre><code>&lt;!-- https://mvnrepository.com/artifact/org.slf4j/jul-to-slf4j --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;jul-to-slf4j&lt;/artifactId&gt;
      &lt;version&gt;1.7.25&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>With this configuration (console + daily file):</p>
  
  <pre><code># Set root logger level to DEBUG and its only appender to A1.
  log4j.rootLogger=DEBUG, A1, RollingAppender
  # A1 is set to be a ConsoleAppender.
  log4j.appender.A1=org.apache.log4j.ConsoleAppender
  # A1 uses PatternLayout.
  log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  log4j.appender.A1.layout.ConversionPattern=[%-5p] %d %c - %m%n
  
  log4j.appender.RollingAppender=org.apache.log4j.DailyRollingFileAppender
  log4j.appender.RollingAppender.File=pos.log
  log4j.appender.RollingAppender.DatePattern='.'yyyy-MM-dd
  log4j.appender.RollingAppender.layout=org.apache.log4j.PatternLayout
  log4j.appender.RollingAppender.layout.ConversionPattern=[%-5p] %d %c - %m%n
  </code></pre>
  
  <p>And then put this code at the beginning:</p>
  
  <pre><code>    LogManager.getLogManager().reset();
      SLF4JBridgeHandler.removeHandlersForRootLogger();
      SLF4JBridgeHandler.install();
      Logger.getLogger("POS").setLevel(FINEST);
  </code></pre>
  
  <p>With this, the file is created (lib.log) but it's empty. And the output doesn't go to <strong>pos.log</strong> ( the one configured in log4j).</p>
  
  <p>What I'm missing? Thanks!</p>