<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><blockquote type="cite" class="clean_bq" style="font-family: helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span><div><div>> Some code simply can not use static class references and has to use<span class="Apple-converted-space"> </span><br>> obj.getClass() to configure a Logger instance.<span class="Apple-converted-space"> </span><br><br>Can you elaborate what use case that would be?<span class="Apple-converted-space"> </span><br>I haven't seen that yet.<span class="Apple-converted-space"> </span></div></div></span></blockquote></div><p>Sure we have several framework support classes that setup loggers, which can not be done in a static context, so they have to:</p><p>Logger log = LoggerFactory.getLogger(getClass());</p><p>This is not something that can be easily changed without completely breaking everything using those classes.</p><p><br></p><div><div><blockquote type="cite" class="clean_bq" style="font-family: helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span><div><div>Is this a serious problem? <br>End users aren't supposed to see the stack traces, and support people<span class="Apple-converted-space"> </span><br>shouldn't care that much, they'll quickly learn to ignore anything after<span class="Apple-converted-space"> </span><br>a $.<span class="Apple-converted-space"> </span></div></div></span></blockquote></div><p>Its not the stack traces, is the log messages which include the logger name which is problematic, as well as the configuration of loggers when/if levels have to be changed.</p><p>And our product is an application server, so the logs are an aspect of the system which users do consume.</p><p><br></p><div><div><div><blockquote type="cite" class="clean_bq" style="font-family: helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span><div><div>> The AOP stuff here is an impl detail and IMO should leak out into <br>> logging context.<span class="Apple-converted-space"> </span><br><br>A log can contain stack traces, that's even more implementation details.<span class="Apple-converted-space"> </span><br>Actually, the class and thread name in each log line are implementation<span class="Apple-converted-space"> </span><br>details, too.<span class="Apple-converted-space"> </span></div></div></span></blockquote></div><p>I’m not interested in debating semantics here.   I’m trying to ask if folks think it may be a good (or bad) idea for slf4j-api to cope with enhanced classes to simplify/normalize logger names for both output handling (ie what shows up in the appender outputs) as well as for configuration (ie. wheter you configure the class-name or class-name$$EnhancerByGuice$$.</p><p>I can and likely will adapt our software to use the helper I mentioned to keep things simple/normalized, but I am curious to see if anyone things this should be generalized into the slf4j-api generally or not.</p><p><br></p><div><div><blockquote type="cite" class="clean_bq" style="font-family: helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span><div><div>> I’m wondering if there is a simple/elegant way to handle this in the <br>> slf4j-api (and become generally transparent to applications)<span class="Apple-converted-space"> </span><br><br>Possibly a pattern evaluator for emitting class names that strips the<span class="Apple-converted-space"> </span><br>enhancement markers. Or replaces them with something shorter - sometimes<span class="Apple-converted-space"> </span><br>people might want to know whether an enhanced or an unenhanced class was<span class="Apple-converted-space"> </span><br>called (the unenhanced version of any class can stick around and<span class="Apple-converted-space"> </span><br>actually get called e.g. in Spring, I think).<span class="Apple-converted-space"> </span></div></div></span></blockquote></div><p>I am not aware of any pluggable aspect of slf4j-api here to do that.  I was considering an optional system property which when true would kick in in org.slf4j.LoggerFactory.getLogger(Class) to handle this behavior and then delegate to another static helper which the application could provide to sanitize the class reference before handing it over to the underlying provider.</p><p>—jason</p><p><br></p></div></div><div></div></div></div></body></html>