<div dir="ltr">We should not require having two logger fields in a class. Instead we should create a wrapper logger that gives access to the class logger for debug, but also the special loggers for other log output. For example:<div><br></div><div> final KeycloakLogger logger = KeycloakLogger.getLogger(MyClass.class);</div><div><br></div><div> logger.debug("Hello world!");</div><div> logger.config().serverConfigNotFound();</div><div> logger.realm().realmNameInUse(realmName);</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 22 January 2016 at 18:36, Stan Silvert <span dir="ltr"><<a href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> From yesterday's discussion, it was clear that as a group, we consider<br>
debug/trace logging to be fundamentally different from other logging.<br>
The loggers I've been concerned with will be logged through a limited<br>
number of keycloak loggers using broad categories such as User, Realm,<br>
Config, etc.<br>
<br>
But for debug/trace logging, we want the category to be based upon the<br>
class it was logged from. That way, you can turn logging on for a<br>
particular class, package, or sub-package to do your trace.<br>
<br>
There is no good way to do both kinds of logging using the same logger<br>
instance. Therefore, I propose that debug/trace logging be done the<br>
same way we've always done it. Declare a debug/trace logger in your<br>
class and use that. Other logging will be done through the keycloak logger.<br>
<br>
So, to do both kinds of logging in the same class, you declare two loggers:<br>
<br>
private static final KeycloakLogger kcLogger = KeycloakLogger.ROOT_LOGGER;<br>
private static final Logger debugLogger = Logger.getLogger(MyClass.class);<br>
.....<br>
kcLogger.CONFIG.localizedMessage("My localized message"); // logged to<br>
"keycloak-config" category<br>
.....<br>
debugLogger.debug("My debug message"); // logged to<br>
"org.keycloak.mypackage.MyClass" category<br>
<br>
Comments?<br>
<br>
_______________________________________________<br>
keycloak-dev mailing list<br>
<a href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a><br>
</blockquote></div><br></div>