<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">I like using <a href="https://projectlombok.org/features/Log.html">Lombok's @Slf4j</a> annotation for this</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 9, 2016 at 3:45 PM, Gary Gregory <span dir="ltr"><<a href="mailto:garydgregory@gmail.com" target="_blank">garydgregory@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>But that does not work for static loggers. Do you always want to create or lookup one logger per instance?<div><br></div><div>Gary</div></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Mon, May 9, 2016 at 1:19 PM, Jeff Jensen <span dir="ltr"><<a href="mailto:jjensen@apache.org" target="_blank">jjensen@apache.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Perhaps you can use "getClass()" for instance logging?</div><div><br></div><div>For my teams, I make an IDE macro (named "log") that auto-inserts this line at the cursor:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">private final Logger log = LoggerFactory.getLogger(getClass());</font></div></blockquote><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 9, 2016 at 1:54 PM, Zack Sampson <span dir="ltr"><<a href="mailto:Zack.Sampson@twosigma.com" target="_blank">Zack.Sampson@twosigma.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">Hey,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">We’ve recently migrated from our own façade around log4j to SLF4J. One of the niceties we leave behind is a nullary getLogger call, kind of like so:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Logger _log = Logger.getLogger();<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">We use reflection to look at the stack and get the calling class’s name. We find this more convenient and consistent than manually specifying the name of the class.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Is there any reason SLF4J doesn’t support something like this?<u></u><u></u></p>
</div>
</div>
<br>_______________________________________________<br>
slf4j-user mailing list<br>
<a href="mailto:slf4j-user@qos.ch" target="_blank">slf4j-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/slf4j-user" rel="noreferrer" target="_blank">http://mailman.qos.ch/mailman/listinfo/slf4j-user</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
slf4j-user mailing list<br>
<a href="mailto:slf4j-user@qos.ch" target="_blank">slf4j-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/slf4j-user" rel="noreferrer" target="_blank">http://mailman.qos.ch/mailman/listinfo/slf4j-user</a><br></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div><div dir="ltr">E-Mail: <a href="mailto:garydgregory@gmail.com" target="_blank">garydgregory@gmail.com</a> | <a href="mailto:ggregory@apache.org" target="_blank">ggregory@apache.org </a><br><a href="http://www.manning.com/bauer3/" target="_blank">Java Persistence with Hibernate, Second Edition</a><br><a href="http://www.manning.com/tahchiev/" target="_blank">JUnit in Action, Second Edition</a><br><a href="http://www.manning.com/templier/" target="_blank">Spring Batch in Action</a><br>Blog: <a href="http://garygregory.wordpress.com/" target="_blank">http://garygregory.wordpress.com</a> <br>Home: <a href="http://garygregory.com/" target="_blank">http://garygregory.com/</a><br>Tweet! <a href="http://twitter.com/GaryGregory" target="_blank">http://twitter.com/GaryGregory</a></div></div>
</font></span></div>
<br>_______________________________________________<br>
slf4j-user mailing list<br>
<a href="mailto:slf4j-user@qos.ch">slf4j-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/slf4j-user" rel="noreferrer" target="_blank">http://mailman.qos.ch/mailman/listinfo/slf4j-user</a><br></blockquote></div><br></div>