<div dir="ltr">Hello,<div><br></div><div>I'll start with a quick clarification, to avoid confusion: my question relates to usage of Logback loggers via SLF4J (and, sometimes but not always, also via the Log4J-to-SLF4J bridge) from Groovy code, and is not about configuring Logback using Groovy (as it happens, we configure Logback directly via the API, and not using configuration files).</div><div><br></div><div>In Groovy code, it's perfectly fine to write something like this:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">def somevar = 'world'</font></div><div><font face="monospace, monospace">log.debug "Hello ${somevar}"</font></div></blockquote><div><br></div><div>The "debug" method call doesn't need parentheses because there's only one parameter (and, furthermore, it's using the "GString" interpolation approach).  Our application can be extended with Groovy scripts by our customers, so we find this in their code when helping them customize.</div><div><br></div><div>So we often end up with entries like this (obviously simplified here) in our log files:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">2015-01-20 17:55:17,715 DEBUG - [Category$debug.call:?] Hello world</font></div></blockquote><div><br></div><div>So the class name and method name being reported as the location are actually the locations of the Groovy call site, and not the actual "log.debug" call.</div><div><br></div><div>Some sort of general capability along the lines of LOGBACK-540 might be helpful, but here the requirement is just to truncate the topmost "internal Groovy" stack frame (or frames) so that the reported location is the call into the logger in the script.  Is this possible, and how could it be achieved?  I seem to remember an example of this a long time ago, but I can't find it amongst all the search results referring to Groovy configuration.</div><div><br clear="all"><div><div class="gmail_signature">Thanks,<br>Christopher<br></div></div><div class="gmail_signature"><br></div>
</div></div>