title: How to disable Logback output to console programmatically but append to file
body: <p>I have setup Logback file appender programmatically and set log level into <code>ALL</code>.
  The reason was to set log level <code>ALL</code> i wanted to log file contains all log details like<code>(INFO,DEBUG,WARN and etc...)</code>But i want to avoid those details  from the console.If anyone knows please let me know how can i disable Logback output to console programmatically.</p>
  
  <p><strong>Logger code snippet</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/16910955/programmatically-configure-logback-appender">Reference</a></p>
  
  <pre><code>private static Logger createLoggerFor(String string, String file) {
            LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
            PatternLayoutEncoder ple = new PatternLayoutEncoder();
  
            ple.setPattern("%date %level [%thread] %logger{10} [%file:%line] %msg%n");
            ple.setContext(lc);
            ple.start();
            FileAppender&lt;ILoggingEvent&gt; fileAppender = new FileAppender&lt;ILoggingEvent&gt;();
            fileAppender.setFile(file);
            fileAppender.setEncoder(ple);
            fileAppender.setContext(lc);
            fileAppender.start();
  
            Logger logger = (Logger) LoggerFactory.getLogger(string);
            logger.addAppender(fileAppender);
            logger.setLevel(Level.ALL);
            logger.setAdditive(false); /* set to true if root should log too */
  
            return logger;
      }
  </code></pre>
  
  <p><strong>Note</strong>:When i set log level <code>WARN</code> or <code>DEBUG</code> details doesnt show  in the log file as well as console out put.But i want to log every details in to log file including <code>INFO</code>.</p>