title: how to print log.info message in log file
body: <p>I need to know how to print a log.info message. I have no knowledge about using loggers. But I tried this code using netbeans and this didn't work. here is the code:</p>
  
  <pre><code>public class login {
      Logger log = Logger.getLogger("myFirstLog");
  
      public static void main(String arg[]) {
          initLogger();
          LoginUser();
      }
  
      public static void LoginUser() {              
          log.info("user logged in");
      }
  
      public static void initLogger() {
          try {
              String filePath = "E:/myFirstLog.log";
              PatternLayout layout = new PatternLayout("%-5p %-10d %m %n");
  
              RollingFileAppender appender = new RollingFileAppender(layout, filePath);
              appender.setName("myFirstLog");
              appender.setMaxFileSize("1MB");
              appender.activateOptions();
  
              Logger.getRootLogger().addAppender(appender);
  
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>A log file is created with no log information.How to fix this code to get info messages in log file?</p>