title: Calling log4j's log methods indirectly (from a helper method)
body: <p>I'd like to put the logger.debug(...) call into a helper method, and call that helper method from anywhere that needs to write the log. While this mostly works fine, the log entry itself shows the helper method as the source of the call, which is understandable since log4j isn't aware of me using a helper method for logging.</p>
  
  <p>Is there any way to tell it to skip the helper method when figuring out the source of the logger.debug(...) call and instead use its caller?</p>
  
  <p>By source, I mean <strong>%F:%L</strong> of org.apache.log4j.PatternLayout: <a href="https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html" rel="nofollow">https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html</a></p>
  
  <p>To illustrate what I mean, here's an example stack trace:</p>
  
  <pre><code>1. logger.debug(msg, throwable)
  2. logHelper(logger, msg, throwable) &lt;-- currently shows as the source of the call, since it calls logger.debug directly
  3. someFunction &lt;-- where the real logable event occurs, so I'd want this to be logged as the source
  </code></pre>
  
  <p>The reason I'm doing this is because I'd like an exception logged only by name (e.toString) if the log level is INFO, or with a full stack trace if the level is DEBUG. I'm open to suggestions for alternatives.</p>
  
  <p>Thanks! :)</p>