<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">It sounds like what you want is something like <a href="https://svn.apache.org/repos/asf/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/">https://svn.apache.org/repos/asf/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/</a>  (but for Logback of course) that will let you modify the event.<div><br></div><div>Ralph<br><div><br></div><div>On Nov 5, 2011, at 8:59 AM, Steve Cohen wrote:<div><br class="Apple-interchange-newline"><blockquote type="cite"><div>To answer my own question, a partial answer is the "caller" formatting specifier.  getLocationInformation() may or may not have been necessary, but with "caller" it no longer is.<br><br>However,<br><br>a common pattern is to funnel logging requests through a LogHelper class to add some additional functionalities not supported by log4j or logback.  The LogHelper may throw something on the MDC or do some other preprocessing.  My LogHelper also adds methods that apply String.format() on the parameters a la printf.<br><br>Whatever.  Many such things are possible.<br><br>The problem with the caller specifier is that the  LogHelper calls (which are nested) are what it displays, not the true caller in the non-logHelper code.  The depth parameter allows you to eventually see the "real" code but really we want the logHelper to disappear from the display.  That is display only one element - the one we want.<br><br>I've written a class similar to the ch.qos.logback.classic.pattern.CallerDataConverter (actually I just grabbed the source and modified) so that instead of a depth I pass the FQCN of the LogHelper class and the convert method skips all elements until it finds one that doesn't match this, and it displays that.<br>This works very well, but it would be nice if logback offered a better way to extend its framework to support this kind of conversion.  The only reason I had to resort to reuse by copying instead of reuse by inheritance is that CallerDataConverter has some private methods that I needed to call from convert().  If these were protected, it would provide much greater flexibility.<br><br>Logback should consider supporting such functionality.<br><br><br><br><br>On 11/02/2011 09:54 PM, Steve Cohen wrote:<br><blockquote type="cite">how would I replace log4j's LoggingEvent.getLocationInformation() in<br></blockquote><blockquote type="cite">logback?<br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">Logback-user mailing list<br></blockquote><blockquote type="cite"><a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br></blockquote><blockquote type="cite"><a href="http://mailman.qos.ch/mailman/listinfo/logback-user">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><br>_______________________________________________<br>Logback-user mailing list<br><a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>http://mailman.qos.ch/mailman/listinfo/logback-user<br></div></blockquote></div><br></div></div></body></html>