title: Implementing logger for java application
body: <p>I am trying to implement logger using apache commonn logging and log4j.xml file as configuration file .</p>
  
  <p>So in the actual java code i am writing log as </p>
  
  <p>I am using appache common logging </p>
  
  <pre><code>import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  </code></pre>
  
  <p>and i am logging information such as in . I am creating a instance of log for each class</p>
  
  <pre><code> private static Log    logger  = LogFactory.getLog( MyClass.class );
      private static final String      name   ="SAM";
      logger.info("name= "+name);
  </code></pre>
  
  <ol>
  <li><p>So now my question is does implementing logger like this create a performanace issue?</p></li>
  <li><p>Is it necessary to check log like   </p>
  
  <pre><code>if ( log.isInfoEnabled( ) ) 
   {
    log.info( "Info message" );
    }
  </code></pre></li>
  </ol>
  
  <p>The confusion is mainly because in Apache common logging they have mentioned to do this and in log4j they have mentioned it is unnecessary.</p>
  
  <p>Each time when we write log in the files?</p>
  
  <p>-Sam</p>