<div dir="ltr">Ok, let&#39;s just keep debug and trace statements as is then. If WildFly can get away without codes and internationalization of those so can we.</div><div class="gmail_extra"><br><div class="gmail_quote">On 18 January 2016 at 19:52, Stan Silvert <span dir="ltr">&lt;<a href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>&gt;</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"><span class="">
    <div>On 1/18/2016 1:23 PM, Stian Thorgersen
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On 18 January 2016 at 16:45, Stan
            Silvert <span dir="ltr">&lt;<a href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>&gt;</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"><span>
                  <div>On 1/18/2016 9:56 AM, Stan Silvert wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div>On 1/18/2016 8:25 AM, Stan Silvert wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div>On 1/18/2016 3:02 AM, Stian Thorgersen wrote:<br>
                      </div>
                      <blockquote type="cite">
                        <div dir="ltr">Looks good how you&#39;ve done it.
                          <div><br>
                          </div>
                          <div>Bill is currently working on
                            re-organizing code, but he&#39;s not going to
                            move anything from services. So can you
                            finish up services and send a PR for it?
                            Then you can do the other logging once Bill
                            is completed.</div>
                        </div>
                      </blockquote>
                      Assuming nobody has an objection to the proposed
                      format, I&#39;ll go ahead and finish services.<br>
                    </blockquote>
                    <br>
                    Another thing to consider is DEBUG logging.  Do we
                    want to localize debug messages?  <br>
                  </blockquote>
                </span> I grepped the WildFly code.  I could only find a
                handful of examples where somebody localized a debug
                message.  Looks like for the most part, their debug
                messages are not localized.</div>
            </blockquote>
            <div><br>
            </div>
            <div>We barely have any info logging, neither does WildFly.
              Seems weird to treat them differently.</div>
          </div>
        </div>
      </div>
    </blockquote></span>
    Yes,  from what I&#39;ve seen so far, most of our logging is ERROR,
    WARN, or DEBUG.  Very little INFO and a tiny bit of TRACE.<span class=""><br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>Is it just internationalization or log codes as well
              they don&#39;t have for debug?</div>
          </div>
        </div>
      </div>
    </blockquote></span>
    Neither.  Except for a couple of places I found, they aren&#39;t doing
    anything special with debug messages.<br>
    <br>
    Debug messages can still get logged using the same per-module logger
    that is used for localized logging.  So we can have:<br>
    protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;<br>
    ....<br>
    <span>logger<span>.</span>debugv(<span><span>&quot;</span>Client {0}
        authenticated by {1}<span>&quot;</span></span>, client<span>.</span>getClientId(), factory<span>.</span>getId());</span><br>
    <br>
    These would not be localized and would not be given a message
    number.  If you want them localized with message number you need:<br>
    <br>
    logger.clientAuthenticated(<span>client<span>.</span>getClientId(), factory<span>.</span>getId());<br>
      ...<br>
    </span>@LogMessage(level = DEBUG)<br>
    @Message(id=45, value=&quot;Client %s authenticated by %s&quot;)<br>
    void clientAuthenticated(String clientId, String factoryId);<div><div class="h5"><br>
    <br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div text="#000000" bgcolor="#FFFFFF"><span><br>
                  <blockquote type="cite"> <br>
                    <br>
                    <blockquote type="cite"> <br>
                      <blockquote type="cite">
                        <div class="gmail_extra"><br>
                          <div class="gmail_quote">On 15 January 2016 at
                            22:12, Stan Silvert <span dir="ltr">&lt;<a href="mailto:ssilvert@redhat.com" target="_blank">ssilvert@redhat.com</a>&gt;</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">
                                I&#39;ve completed a first stab at this
                                using the JBoss logging tools.  Once
                                merged we will have the ability to do
                                i18n/l10n on our log messages and also
                                use message numbers.<br>
                                <br>
                                Here is the commit to show you how it
                                turns out converting the log messages in
                                KeycloakApplication:<br>
                                <a href="https://github.com/ssilvert/keycloak/commit/54faba37cb4797fc337569899d8ac8eaa7f0ad1a#diff-72ce0a0a72ebd57f8627c059f7f1ea03R1" target="_blank">https://github.com/ssilvert/keycloak/commit/54faba37cb4797fc337569899d8ac8eaa7f0ad1a#diff-72ce0a0a72ebd57f8627c059f7f1ea03R1</a><br>
                                <br>
                                So, now a message coming from the
                                KeycloakApplication class in the
                                services module looks like this:<br>
                                <br>
                                15:29:31,515 INFO  [<b>org.keycloak.services</b>]
                                (ServerService Thread Pool -- 50)<b>
                                  KC-SERVICES0001</b>: Loading config
                                from
c:\GitHub\keycloak\distribution\server-dist\target\keycloak-1.9.0.CR1-SNAPSHOT\standalone\configuration\keycloak-server.json<br>
                                <br>
                                We need to decide how we want to
                                structure this.  In WildFly, we
                                typically have one logger per maven
                                module.  If you want to have one logger
                                per package then you would need to
                                create a new interface in each package,
                                which gets hairy.<br>
                                <br>
                                I do suggest that we prefix all of our
                                messages with &quot;KC-&quot; or something else
                                that is unique across products.  Also,
                                we should standardize the &quot;padding&quot; for
                                the message numbers.<br>
                                <br>
                                Another possibility is to have all
                                keycloak messages start with
                                &quot;KEYCLOAK&quot;.  This would mean that we
                                would need for each module to reserve a
                                number range.  There are annotations to
                                enforce this if we want to go that
                                route.  The downside is that somewhere
                                we need to maintain a registry.  I think
                                WildFly did this but eventually
                                abandoned it.  Notice that WildFly
                                messages are like &quot;WFLYUT&quot; for Undertow
                                or &quot;WFLYJSF&quot; for JSF.<br>
                                <br>
                                BTW, localization works nicely.  Just
                                add a bundle for a new language.  The
                                tool even creates a skeleton properties
                                file for you.<br>
                                <br>
                                If you want more details on the i18n
                                framework, see <a href="https://developer.jboss.org/wiki/JBossLoggingTooling" target="_blank">https://developer.jboss.org/wiki/JBossLoggingTooling</a>.<span><font color="#888888"><br>
                                    <br>
                                    Stan<br>
                                  </font></span></div>
                              <br>
_______________________________________________<br>
                              keycloak-dev mailing list<br>
                              <a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">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>
                      </blockquote>
                      <br>
                      <br>
                      <fieldset></fieldset>
                      <br>
                      <pre>_______________________________________________
keycloak-dev mailing list
<a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a></pre>
                    </blockquote>
                    <br>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
keycloak-dev mailing list
<a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">keycloak-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-dev</a></pre>
                  </blockquote>
                  <br>
                </span></div>
              <br>
              _______________________________________________<br>
              keycloak-dev mailing list<br>
              <a href="mailto:keycloak-dev@lists.jboss.org" target="_blank">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>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>