title: scala use same logger into class and companion object
body: <p>I would try to log using a particular log4j  logger called URM that log into a a file into a scala class and I need to use the same logger also in the companion object:</p>
  
  <p><strong>class</strong></p>
  
  <pre><code>class MyClass{
     ...
     val logger = Logger.getLogger("URMLogger")
     logger.info("message log")
     ....
  }
  </code></pre>
  
  <p><strong>companion object</strong></p>
  
  <pre><code>object MyClass{
     ...
     logger.info("message log")
     ...
  }
  </code></pre>
  
  <p><strong>Log4j.properties</strong></p>
  
  <pre><code>...
  log4j.logger.URMLogger=DEBUG,URM
  log4j.appender.URM=org.apache.log4j.FileAppender
  log4j.appender.URM.File=target/URM.log
  log4j.appender.URM.layout=org.apache.log4j.PatternLayout
  log4j.appender.URM.layout.ConversionPattern=%d %p %t [%c] - %m%n
  ...
  </code></pre>
  
  <p>How can I initialize once my logger and use it in both class e object companion?</p>