<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 1/25/2016 9:46 AM, Stian Thorgersen
wrote:<br>
</div>
<blockquote
cite="mid:CAJgngAe7ZuvDp8TFYf-gbTeBMPrDvNsTfKygXsJ+9-8=vxgUPA@mail.gmail.com"
type="cite">
<div dir="ltr">How does it look like from a usage perspective
then?</div>
</blockquote>
private static final KeycloakLogger logger =
Logger.getMessageLogger(KeycloakLogger.class,
MyClass.class.getName());<br>
.....<br>
logger.CONFIG.localizedMessage("My localized message"); // logged to
"keycloak-config" category<br>
.....<br>
logger.debug("My debug message"); // logged to
"org.keycloak.mypackage.MyClass" category
<blockquote
cite="mid:CAJgngAe7ZuvDp8TFYf-gbTeBMPrDvNsTfKygXsJ+9-8=vxgUPA@mail.gmail.com"
type="cite">
<div class="gmail_extra"><br>
<div class="gmail_quote">On 25 January 2016 at 15:34, Stan
Silvert <span dir="ltr"><<a moz-do-not-send="true"
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">
<div text="#000000" bgcolor="#FFFFFF">
<div>Actually, the solution was even simpler than that. I
guess I just needed the weekend to clear my head.
<div>
<div class="h5"><br>
<br>
On 1/25/2016 7:16 AM, Stian Thorgersen wrote:<br>
</div>
</div>
</div>
<div>
<div class="h5">
<blockquote type="cite">
<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
moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:keycloak-dev@lists.jboss.org"
target="_blank">keycloak-dev@lists.jboss.org</a><br>
<a moz-do-not-send="true"
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>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>