Anthony,<br><br>here is an updated patch concerning both PlatformLogger and Logger &#39;bad&#39; usages:<br><a href="http://jmmc.fr/~bourgesl/share/webrev-8010297.3/">http://jmmc.fr/~bourgesl/share/webrev-8010297.3/</a><br>
<br>It impacts now awt, swing, JMX, security, network, and apache xml.<br><br>Thanks for the review,<br>Laurent<br><br><div class="gmail_quote">2013/4/8 Laurent Bourgès <span dir="ltr">&lt;<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Peter, Mandy,<br><br>I think it would be great to make PlatformLogger very similar to Logger API: <br>
I mean JUL Logger already has only 1 convenient method with 1 param so it may be great to have the same API in PlatformLogger too: maybe extend it to 2 or 3 params ...<br>
<br>Peter, could you look at the API differences between Logger / PlatformLogger to make PlatformLogger API more similar to JUL Logger ?<span class="HOEnZb"><font color="#888888"><br><br>Laurent</font></span><div class="HOEnZb">
<div class="h5"><br><br><div class="gmail_quote">2013/4/8 Peter Levart <span dir="ltr">&lt;<a href="mailto:peter.levart@gmail.com" target="_blank">peter.levart@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div>
    <div>On 04/07/2013 07:11 PM, Laurent Bourgès
      wrote:<br>
    </div>
    <blockquote type="cite">
      <p>Hi</p>
      <p>I started fixing All PlatformlLogger &quot;bad&quot; usages and I am
        fixing also many jul Logger usages without isLoggable ...<br>
        That represents a lot of changes and a very boring job.</p>
      <p>I think sending a webrew tomorrow.</p>
    </blockquote>
    <br></div>
    Hi Laurent,<br>
    <br>
    Since you&#39;re already deep in the task, you might have a rough
    feeling what part of such unguarded log statements are of the
    following type:<br>
    <br>
    logger.[fine,info,...](&quot;a message with {0} and {1} placeholders&quot;,
    someArg1, someArg2);<br>
    <br>
    where someArg1, ... are some values that are already present in the
    context of the logging statement and don&#39;t have to be computed just
    for satisfying the logging (not even boxing). Such usages could be
    effectively optimized by adding some overloaded methods to
    PlatformLogger that take 1, 2, 3, ... arguments:<br>
    <br>
    <tt>class PlatformLogger {</tt><tt><br>
    </tt><tt><br>
          ...<br>
      <br>
          public void finest(String msg, Object param1) {<br>
              if (isLoggable(Level.FINEST)) {<br>
                  loggerProxy.doLog(Level.FINEST, msg, param1);<br>
              }<br>
          }<br>
      <br>
          public void finest(String msg, Object param1, Object param2) {<br>
              if (isLoggable(Level.FINEST)) {<br>
                  loggerProxy.doLog(Level.FINEST, msg, param1, param2);<br>
              }<br>
          }<br>
      <br>
          public void finest(String msg, Object param1, Object param2,
      Object param3) {<br>
              if (isLoggable(Level.FINEST)) {<br>
                  loggerProxy.doLog(Level.FINEST, msg, param1, param2,
      param3);<br>
              }<br>
          }<br>
    </tt><tt><br>
    </tt><tt>...<br>
    </tt><br>
    This would effectively guard creation of the arguments array with an
    isLoggable check for some common usages, eliminating the need to
    explicitly guard such statements. Of course, the user would have to
    be aware of when such unguarded logging statement is without
    overhead and when not...<br>
    <br>
    How do you feel about such API extension?<br>
    <br>
    <br>
    Regards, Peter<div><div><br>
    <br>
    <br>
    <blockquote type="cite">
      <p>Laurent</p>
      <div class="gmail_quote">Le 4 avr. 2013 14:08, &quot;Laurent Bourgès&quot;
        &lt;<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;
        a écrit :<br type="attribution">
        <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          Ok, I can provide an updated patch after finding / fixing all
          usages.<br>
          <br>
          Probably in 1 or 2 days,<br>
          <br>
          Laurent<br>
          <br>
          <div class="gmail_quote">2013/4/4 Anthony Petrov <span dir="ltr">&lt;<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a>&gt;</span><br>
            <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Yes, this makes sense.
              Do you want to update your fix for 8010297 to include
              these changes as well?<br>
              <br>
              --<br>
              best regards,<br>
              Anthony
              <div><br>
                <br>
                On 04/04/13 15:47, Laurent Bourgès wrote:<br>
              </div>
              <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                Dear all,<br>
                <br>
                <div>
                  I just realized there is another problem with
                  PlatformLogger log statements:<br>
                  XBaseWindow:<br>
                       public boolean grabInput() {<br>
                           grabLog.fine(&quot;Grab input on {0}&quot;, this);<br>
                  ...<br>
                  }<br>
                  <br>
                  This calls the PlatformLogger.fine( varargs):<br>
                       public void fine(String msg, Object... params) {<br>
                           logger.doLog(FINE, msg, params);<br>
                       }<br>
                  <br>
                  Doing so, the JVM creates a new Object[] instance to
                  provide params as<br>
                  varargs.<br>
                  <br>
                  I would recommend using isLoggable() test to avoid
                  such waste if the log<br>
                  is disabled (fine, finer, finest ...).<br>
                  <br>
                  Do you want me to provide a new patch related to this
                  problem ?<br>
                  <br>
                  Does somebody have an idea to automatically analyze
                  the JDK code and<br>
                  detect missing isLoggable statements ...<br>
                  <br>
                  Regards,<br>
                  Laurent<br>
                  <br>
                  2013/4/3 Laurent Bourgès &lt;<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a><br>
                </div>
                &lt;mailto:<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;&gt;
                <div><br>
                  <br>
                      Anthony,<br>
                  <br>
                      could you tell me once it is in the OpenJDK8
                  repository ?<br>
                      I would then perform again profiling tests to
                  check if there is no<br>
                      more missing isLoggable() statements.<br>
                  <br>
                      Once JMX and other projects switch to
                  PlatformLogger, I could check<br>
                      again.<br>
                  <br>
                      Maybe I could write a small java code checker (pmd
                  rule) to test if<br>
                      there is missing isLoggable() statements wrapping
                  PlatformLogger log<br>
                      statements. Any idea about how to reuse java
                  parser to do so ?<br>
                  <br>
                      Regards,<br>
                  <br>
                      Laurent<br>
                  <br>
                      2013/4/2 Anthony Petrov &lt;<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a><br>
                </div>
                    &lt;mailto:<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a>&gt;&gt;
                <div><br>
                  <br>
                          Looks fine to me as well. Thanks for fixing
                  this, Laurent.<br>
                  <br>
                          Let&#39;s wait a couple more days in case Net or
                  Swing folks want to<br>
                          review the fix. After that I&#39;ll push it to the
                  repository.<br>
                  <br>
                          --<br>
                          best regards,<br>
                          Anthony<br>
                  <br>
                  <br>
                          On 4/2/2013 15:35, Laurent Bourgès wrote:<br>
                  <br>
                              Here is the updated patch:<br>
                </div>
                            <a href="http://jmmc.fr/%7Ebourgesl/__share/webrev-8010297.2/" target="_blank">http://jmmc.fr/~bourgesl/__share/webrev-8010297.2/</a><br>
                            &lt;<a href="http://jmmc.fr/%7Ebourgesl/share/webrev-8010297.2/" target="_blank">http://jmmc.fr/%7Ebourgesl/share/webrev-8010297.2/</a>&gt;
                <div><br>
                  <br>
                              Fixed inconsistencies between FINE / FINER
                  log statements:<br>
                              - XScrollbarPeer<br>
                              - XWindowPeer<br>
                  <br>
                              Laurent<br>
                  <br>
                              2013/4/2 Anthony Petrov &lt;<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a><br>
                              &lt;mailto:<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a>&gt;<br>
                </div>
                            &lt;mailto:<a href="mailto:anthony.petrov@oracle." target="_blank">anthony.petrov@oracle.</a>__com
                <div><br>
                              &lt;mailto:<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a>&gt;&gt;&gt;<br>
                  <br>
                  <br>
                                   1. Sergey: I believe this is for
                  purposes of better<br>
                              formating the<br>
                                   log output and making it more
                  readable by separating or<br>
                              highlighting<br>
                                   some sections. I don&#39;t think this
                  should be changed.<br>
                  <br>
                                   2. Laurent: can you please address
                  this issue and send<br>
                              us a new patch?<br>
                  <br>
                                   --<br>
                                   best regards,<br>
                                   Anthony<br>
                  <br>
                  <br>
                                   On 4/1/2013 16:08, Sergey Bylokhov
                  wrote:<br>
                  <br>
                  <br>
                                       Hi, Anthony<br>
                                       Only two comments:<br>
                                       1 Why we need some special text
                  in the log output<br>
                              like &quot;***&quot; and<br>
                              &quot;###&quot;<br>
                                       2 XScrollbarPeer.java:<br>
                  <br>
                                       +        if<br>
                </div>
                            (log.isLoggable(____PlatformLogger.FINEST))
                {
                <div><br>
                  <br>
                                       +            log.finer(&quot;KeyEvent
                  on scrollbar: &quot; +<br>
                              event);<br>
                                       +        }<br>
                  <br>
                  <br>
                  <br>
                                       On 4/1/13 12:20 PM, Anthony
                  Petrov wrote:<br>
                  <br>
                                           Awt, Swing, Net engineers,<br>
                  <br>
                                           Could anyone review the fix
                  please? For your<br>
                              convenience:<br>
                  <br>
                                           Bug:<br>
                </div>
                            <a href="http://bugs.sun.com/view_bug.____do?bug_id=8010297" target="_blank">http://bugs.sun.com/view_bug.____do?bug_id=8010297</a><br>
                            &lt;<a href="http://bugs.sun.com/view_bug.__do?bug_id=8010297" target="_blank">http://bugs.sun.com/view_bug.__do?bug_id=8010297</a>&gt;
                <div><br>
                              &lt;<a href="http://bugs.sun.com/view_bug.__do?bug_id=8010297" target="_blank">http://bugs.sun.com/view_bug.__do?bug_id=8010297</a><br>
                              &lt;<a href="http://bugs.sun.com/view_bug.do?bug_id=8010297" target="_blank">http://bugs.sun.com/view_bug.do?bug_id=8010297</a>&gt;&gt;<br>
                  <br>
                                           Fix:<br>
                </div>
                <div>
                              <a href="http://cr.openjdk.java.net/%7E____anthony/8-55-isLoggable-____8010297.0/" target="_blank">http://cr.openjdk.java.net/~____anthony/8-55-isLoggable-____8010297.0/</a><br>
                              &lt;<a href="http://cr.openjdk.java.net/%7E__anthony/8-55-isLoggable-__8010297.0/" target="_blank">http://cr.openjdk.java.net/%7E__anthony/8-55-isLoggable-__8010297.0/</a>&gt;<br>
                              &lt;<a href="http://cr.openjdk.java.net/%__7Eanthony/8-55-isLoggable-__8010297.0/" target="_blank">http://cr.openjdk.java.net/%__7Eanthony/8-55-isLoggable-__8010297.0/</a><br>
                </div>
                <div>
                              &lt;<a href="http://cr.openjdk.java.net/%7Eanthony/8-55-isLoggable-8010297.0/" target="_blank">http://cr.openjdk.java.net/%7Eanthony/8-55-isLoggable-8010297.0/</a>&gt;&gt;<br>
                  <br>
                                           --             best regards,<br>
                                           Anthony<br>
                  <br>
                                           On 3/22/2013 2:26, Anthony
                  Petrov wrote:<br>
                  <br>
                                               Hi Laurent,<br>
                  <br>
                                               The fix looks great to
                  me. Thank you very much.<br>
                  <br>
                                               We still need at least
                  one review, though.<br>
                              Hopefully<br>
                                               net-dev@ and/or
                  swing-dev@ folks might help<br>
                              us out a bit.<br>
                  <br>
                                               --                 best
                  regards,<br>
                                               Anthony<br>
                  <br>
                                               On 3/20/2013 15:10,
                  Anthony Petrov wrote:<br>
                  <br>
                                                   Hi Laurent,<br>
                  <br>
                                                   Thanks for the patch.
                  I&#39;ve filed a bug at:<br>
                </div>
                            <a href="http://bugs.sun.com/view_bug.____do?bug_id=8010297" target="_blank">http://bugs.sun.com/view_bug.____do?bug_id=8010297</a><br>
                            &lt;<a href="http://bugs.sun.com/view_bug.__do?bug_id=8010297" target="_blank">http://bugs.sun.com/view_bug.__do?bug_id=8010297</a>&gt;
                <div><br>
                  <br>
                              &lt;<a href="http://bugs.sun.com/view_bug.__do?bug_id=8010297" target="_blank">http://bugs.sun.com/view_bug.__do?bug_id=8010297</a><br>
                              &lt;<a href="http://bugs.sun.com/view_bug.do?bug_id=8010297" target="_blank">http://bugs.sun.com/view_bug.do?bug_id=8010297</a>&gt;&gt;<br>
                                                   (should be available
                  in a day or two)<br>
                  <br>
                                                   and published a
                  webrev generated from<br>
                              your patch at:<br>
                </div>
                <div>
                              <a href="http://cr.openjdk.java.net/%7E____anthony/8-55-isLoggable-____8010297.0/" target="_blank">http://cr.openjdk.java.net/~____anthony/8-55-isLoggable-____8010297.0/</a><br>
                              &lt;<a href="http://cr.openjdk.java.net/%7E__anthony/8-55-isLoggable-__8010297.0/" target="_blank">http://cr.openjdk.java.net/%7E__anthony/8-55-isLoggable-__8010297.0/</a>&gt;<br>
                              &lt;<a href="http://cr.openjdk.java.net/%__7Eanthony/8-55-isLoggable-__8010297.0/" target="_blank">http://cr.openjdk.java.net/%__7Eanthony/8-55-isLoggable-__8010297.0/</a><br>
                </div>
                <div>
                  <div>
                                &lt;<a href="http://cr.openjdk.java.net/%7Eanthony/8-55-isLoggable-8010297.0/" target="_blank">http://cr.openjdk.java.net/%7Eanthony/8-55-isLoggable-8010297.0/</a>&gt;&gt;<br>
                    <br>
                    <br>
                                                     I&#39;m also copying
                    swing-dev@ and<br>
                                net-dev@ because the<br>
                                                     fix affects those
                    areas too. I myself<br>
                                will review<br>
                                                     the fix a bit later
                    but am sending it<br>
                                now for other<br>
                                                     folks to take a
                    look at it.<br>
                    <br>
                                                     On 3/19/2013 15:29,
                    Laurent Bourgès wrote:<br>
                    <br>
                                                         I am sorry I
                    started modifying<br>
                                PlatformLogger<br>
                                                         and reverted
                    changes to this class<br>
                                as it is<br>
                                                         another topic
                    to be discussed<br>
                                later: isLoggable<br>
                                                         performance and
                    waste due to<br>
                                HashMap&lt;Integer,<br>
                                                         Level&gt; leads
                    to Integer allocations<br>
                                (boxing).<br>
                    <br>
                    <br>
                                                     I saw your message
                    to core-libs-dev@,<br>
                                so I just<br>
                                                     dropped all changes
                    to the<br>
                                PlatformLogger from this<br>
                                                     patch.<br>
                    <br>
                                                         Finally, I have
                    another question<br>
                                related to the<br>
                                                       
                     WrapperGenerator class: it<br>
                                generates a lot of<br>
                                                         empty log
                    statements (XEvent):<br>
                    <br>
                                                          log<br>
                  </div>
                </div>
                            &lt;<a href="http://grepcode.com/file/____repository.grepcode.com/java/____root/jdk/openjdk/6-b14/sun/____awt/X11/XWrapperBase.java#____XWrapperBase.0log" target="_blank">http://grepcode.com/file/____repository.grepcode.com/java/____root/jdk/openjdk/6-b14/sun/____awt/X11/XWrapperBase.java#____XWrapperBase.0log</a><br>


                            &lt;<a href="http://grepcode.com/file/__repository.grepcode.com/java/__root/jdk/openjdk/6-b14/sun/__awt/X11/XWrapperBase.java#__XWrapperBase.0log" target="_blank">http://grepcode.com/file/__repository.grepcode.com/java/__root/jdk/openjdk/6-b14/sun/__awt/X11/XWrapperBase.java#__XWrapperBase.0log</a>&gt;
                <div>
                  <br>
                              &lt;<a href="http://grepcode.com/file/__repository.grepcode.com/java/__root/jdk/openjdk/6-b14/sun/__awt/X11/XWrapperBase.java#__XWrapperBase.0log" target="_blank">http://grepcode.com/file/__repository.grepcode.com/java/__root/jdk/openjdk/6-b14/sun/__awt/X11/XWrapperBase.java#__XWrapperBase.0log</a><br>


                              &lt;<a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/awt/X11/XWrapperBase.java#XWrapperBase.0log" target="_blank">http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/awt/X11/XWrapperBase.java#XWrapperBase.0log</a>&gt;&gt;&gt;.finest<br>


                </div>
                            &lt;<a href="http://grepcode.com/file/____repository.grepcode.com/java/____root/jdk/openjdk/6-b14/java/____util/logging/Logger.java#____Logger.finest%28java.lang.____String%29" target="_blank">http://grepcode.com/file/____repository.grepcode.com/java/____root/jdk/openjdk/6-b14/java/____util/logging/Logger.java#____Logger.finest%28java.lang.____String%29</a><br>


                            &lt;<a href="http://grepcode.com/file/__repository.grepcode.com/java/__root/jdk/openjdk/6-b14/java/__util/logging/Logger.java#__Logger.finest%28java.lang.__String%29" target="_blank">http://grepcode.com/file/__repository.grepcode.com/java/__root/jdk/openjdk/6-b14/java/__util/logging/Logger.java#__Logger.finest%28java.lang.__String%29</a>&gt;
                <div>
                  <br>
                              &lt;<a href="http://grepcode.com/file/__repository.grepcode.com/java/__root/jdk/openjdk/6-b14/java/__util/logging/Logger.java#__Logger.finest%28java.lang.__String%29" target="_blank">http://grepcode.com/file/__repository.grepcode.com/java/__root/jdk/openjdk/6-b14/java/__util/logging/Logger.java#__Logger.finest%28java.lang.__String%29</a><br>


                              &lt;<a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/logging/Logger.java#Logger.finest%28java.lang.String%29" target="_blank">http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/logging/Logger.java#Logger.finest%28java.lang.String%29</a>&gt;&gt;&gt;(&quot;&quot;);<br>


                  <br>
                  <br>
                                                       Is it really
                  useful to have such<br>
                              statements ? I<br>
                                                       would keep logs
                  with non empty<br>
                              messages only.<br>
                  <br>
                                                       See
                  WrapperGenerator:753:<br>
                                                               String
                  s_log =<br>
                  <br>
                </div>
                            (generateLog?&quot;log.finest(\&quot;\&quot;)____;&quot;:&quot;&quot;);
                <div>
                  <div><br>
                    <br>
                    <br>
                    <br>
                                                     I believe they&#39;re
                    used for log<br>
                                formatting purposes<br>
                                                     to separate
                    numerous events in a log<br>
                                (e.g. think of<br>
                                                     mouse-move events -
                    there can be<br>
                                hundreds of them in<br>
                                                     a raw).<br>
                    <br>
                    <br>
                                                     Please note that
                    the hg export format<br>
                                is not that<br>
                                                     useful unless
                    you&#39;re assigned an<br>
                                OpenJDK id already<br>
                                                     (please see
                    Dalibor&#39;s message for<br>
                                details) because I<br>
                                                     can&#39;t import it
                    directly. So for the<br>
                                time being you<br>
                                                     could send just raw
                    patches (i.e. the<br>
                                output of hg<br>
                                                     diff only - and
                    there&#39;s no need to<br>
                                commit your<br>
                                                     changes in this
                    case). Also, please<br>
                                note that the<br>
                                                     mailing lists strip
                    attachments. The<br>
                                reason I got it<br>
                                                     is because I was
                    listed in To: of your<br>
                                message. So<br>
                                                     when sending
                    patches you can:<br>
                                                     1) post them
                    inline, or<br>
                                                     2) attach them and
                    add a person to To:<br>
                                of your<br>
                                                     message, or<br>
                                                     3) upload them
                    somewhere on the web.<br>
                                                     However, it would
                    be best if you could<br>
                                generate a<br>
                                                     webrev for your
                    changes and upload it<br>
                                somewhere.<br>
                                                     Currently this is
                    the standard format<br>
                                for reviewing<br>
                                                     fixes in OpenJDK.<br>
                    <br>
                                                     --                
                        best regards,<br>
                                                     Anthony<br>
                    <br>
                    <br>
                                                         Regards,<br>
                                                         Laurent<br>
                    <br>
                    <br>
                    <br>
                                                         2013/3/19
                    Laurent Bourgès<br>
                                &lt;<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>
                    &lt;mailto:<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;<br>
                                &lt;mailto:<a href="mailto:bourges.laurent@gmail." target="_blank">bourges.laurent@gmail.</a>__com<br>
                                &lt;mailto:<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;&gt;<br>
                  </div>
                </div>
                <div>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail" target="_blank">bourges.laurent@gmail</a>.<br>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail" target="_blank">bourges.laurent@gmail</a>.&gt;____com<br>
                  <br>
                </div>
                <div>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail." target="_blank">bourges.laurent@gmail.</a>__com<br>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;&gt;&gt;&gt;<br>
                  <br>
                                                           Hi antony,<br>
                  <br>
                                                           FYI I started
                  reviewing and<br>
                              fixing all<br>
                                                       PlatformLogger
                  use cases (not<br>
                                                           too many as I
                  thought first)<br>
                              mainly used by<br>
                                                       awt / swing
                  projects to<br>
                                                           provide you a
                  patch on latest<br>
                              JDK8 source code:<br>
                  <br>
                                                           I am adding
                  the log level check<br>
                              when it is<br>
                                                       missing:<br>
                                                           if<br>
                </div>
                            (...log.isLoggable(____PlatformLogger.xxx))
                {
                <div><br>
                  <br>
                                                               log...<br>
                                                           }<br>
                  <br>
                                                           I will not
                  change the String +<br>
                              operations to<br>
                                                       use the message
                  format<br>
                                                           syntax in
                  this patch.<br>
                  <br>
                                                           Do you accept
                  such patch / proposed<br>
                                                       contribution ?<br>
                  <br>
                                                           Regards,<br>
                                                           Laurent<br>
                  <br>
                  <br>
                                                           2013/3/18
                  Laurent Bourgès<br>
                              &lt;<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>
                  &lt;mailto:<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;<br>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail." target="_blank">bourges.laurent@gmail.</a>__com<br>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;&gt;<br>
                </div>
                <div>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail" target="_blank">bourges.laurent@gmail</a>.<br>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail" target="_blank">bourges.laurent@gmail</a>.&gt;____com<br>
                  <br>
                </div>
                <div>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail." target="_blank">bourges.laurent@gmail.</a>__com<br>
                              &lt;mailto:<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>&gt;&gt;&gt;&gt;<br>
                  <br>
                                                               Hi
                  antony,<br>
                  <br>
                                                               2
                  different things:<br>
                                                               1/
                  PlatformLogger was<br>
                              patched (doLog<br>
                                                       method) to avoid
                  string<br>
                                                             
                   operations (message<br>
                              formatting) for<br>
                                                       disabled logs
                  (patch<br>
                                                               submiited
                  on JDK8 and JDK7u):<br>
                </div>
                            <a href="http://mail.openjdk.java.net/____pipermail/jdk7u-dev/2012-____April/002751.html" target="_blank">http://mail.openjdk.java.net/____pipermail/jdk7u-dev/2012-____April/002751.html</a><br>


                            &lt;<a href="http://mail.openjdk.java.net/__pipermail/jdk7u-dev/2012-__April/002751.html" target="_blank">http://mail.openjdk.java.net/__pipermail/jdk7u-dev/2012-__April/002751.html</a>&gt;
                <div>
                  <br>
                  <br>
                              &lt;<a href="http://mail.openjdk.java.net/__pipermail/jdk7u-dev/2012-__April/002751.html" target="_blank">http://mail.openjdk.java.net/__pipermail/jdk7u-dev/2012-__April/002751.html</a><br>
                              &lt;<a href="http://mail.openjdk.java.net/pipermail/jdk7u-dev/2012-April/002751.html" target="_blank">http://mail.openjdk.java.net/pipermail/jdk7u-dev/2012-April/002751.html</a>&gt;&gt;<br>
                  <br>
                  <br>
                                                               2/ I
                  looked 2 hours ago on<br>
                              JDK7u AND<br>
                                                       JDK8 source codes
                  and both<br>
                                                               still
                  have:<br>
                                                               - log
                  statements WITHOUT<br>
                              log level check<br>
                                                       : if<br>
                  <br>
                </div>
                            (log.isLoggable(____PlatformLogger.FINE))
                <div>
                  <div><br>
                    <br>
                                                         log.fine(...);<br>
                                                                 -
                    string operations (+) in<br>
                                log calls<br>
                                                         that could be
                    improved<br>
                                                                 using
                    the message format<br>
                                syntax (String<br>
                                                         + args): for
                    example,<br>
                                                                 avoid
                    using<br>
                                PlatformLogger.fine(String +<br>
                                                         ...) in favor
                    of using<br>
                                                               
                     PlatformLogger.fine(String msg,<br>
                                                         Object...
                    params)<br>
                    <br>
                                                                 I
                    reported in my previous<br>
                                mail several<br>
                                                         cases where the<br>
                                                               
                     isLoggable() call is<br>
                                missing and leads<br>
                                                         to useless
                    String<br>
                                                               
                     operations but also method<br>
                                calls<br>
                                                       
                     (Component.paramString() for<br>
                                                               
                     example).<br>
                    <br>
                                                               
                     Finally, I also provided<br>
                                other possible<br>
                                                         cases (using
                    grep);<br>
                                                                 maybe
                    there is a better<br>
                                alternative to<br>
                                                         find all
                    occurences of<br>
                                                                 String
                    operations in log calls.<br>
                    <br>
                                                               
                     Regards,<br>
                                                                 Laurent<br>
                    <br>
                                                               
                     2013/3/18 Anthony Petrov<br>
                                &lt;<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a>
                    &lt;mailto:<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a>&gt;<br>
                                &lt;mailto:<a href="mailto:anthony.petrov@oracle." target="_blank">anthony.petrov@oracle.</a>__com<br>
                                &lt;mailto:<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a>&gt;&gt;<br>
                  </div>
                </div>
                <div>
                              &lt;mailto:<a href="mailto:anthony.petrov@oracle" target="_blank">anthony.petrov@oracle</a>.<br>
                              &lt;mailto:<a href="mailto:anthony.petrov@oracle" target="_blank">anthony.petrov@oracle</a>.&gt;____com<br>
                  <br>
                </div>
                <div>
                  <div>
                                &lt;mailto:<a href="mailto:anthony.petrov@oracle." target="_blank">anthony.petrov@oracle.</a>__com<br>
                                &lt;mailto:<a href="mailto:anthony.petrov@oracle.com" target="_blank">anthony.petrov@oracle.com</a>&gt;&gt;&gt;&gt;<br>
                    <br>
                                                                     Hi
                    Laurent,<br>
                    <br>
                                                                   
                     Normally we fix an<br>
                                issue in JDK 8<br>
                                                         first, and then
                    back-port<br>
                                                                     the
                    fix to a 7u<br>
                                release. You&#39;re<br>
                                                         saying that in
                    JDK 8 the<br>
                                                                   
                     problem isn&#39;t<br>
                                reproducible anymore.<br>
                                                         Can you please<br>
                                                                   
                     investigate (using the<br>
                                Mercurial<br>
                                                         history log)
                    what exact fix<br>
                                                                   
                     resolved it in JDK 8?<br>
                    <br>
                                                                     --<br>
                                                                   
                     best regards,<br>
                                                                   
                     Anthony<br>
                    <br>
                                                                     On
                    03/18/13 15:09,<br>
                                Laurent Bourgès<br>
                                                         wrote:<br>
                    <br>
                                                                       
                     Dear all,<br>
                    <br>
                                                                       
                     I run recently<br>
                                netbeans profiler<br>
                                                         on my swing
                    application<br>
                                                                       
                     (Aspro2:<br>
                                <a href="http://www.jmmc.fr/aspro" target="_blank">http://www.jmmc.fr/aspro</a>)
                    under<br>
                                                         linux x64
                    platform and I<br>
                                                                       
                     figured out<br>
                                                                       
                     that a lot of<br>
                                char[] instances<br>
                                                         are coming from
                    String +<br>
                                                                       
                     operator called<br>
                                                                       
                     by sun.awt.X11 code.<br>
                    <br>
                                                                       
                     I looked at<br>
                                PlatformLogger<br>
                                                         source code but
                    found not way<br>
                                                                       
                     to disable it<br>
                                                                       
                     completely: maybe<br>
                                an empty<br>
                                                         logger
                    implementation could<br>
                                                                       
                     be interesting to<br>
                                                                       
                     be used during<br>
                                profiling or<br>
                                                         normal use (not
                    debugging).<br>
                                                                       
                     Apparently JDK8<br>
                                provides some<br>
                                                         patchs to avoid
                    String<br>
                                                                       
                     creation when the<br>
                                                                       
                     logger is disabled<br>
                                (level).<br>
                    <br>
                                                                       
                     However, I looked<br>
                                also to the<br>
                                                         sun.awt code
                    (jdk7u<br>
                                                                       
                     repository) to see the<br>
                                                                       
                     origin of the<br>
                                string allocations:<br>
                                                                       
                     XDecoratedPeer:<br>
                                                                       
                          public void<br>
                                                       
                     handleFocusEvent(XEvent xev) {<br>
                                                                       
                     ...<br>
                                                                       
                     *<br>
                                             focusLog.finer(&quot;Received
                    focus event on shell:<br>
                                &quot; + xfe);<br>
                                                                       
                     *   }<br>
                    <br>
                                                                       
                          public boolean<br>
                                                       
                     requestWindowFocus(long time,<br>
                                                                       
                     boolean timeProvided) {<br>
                                                                       
                     ...<br>
                                                                       
                     *<br>
                                                 focusLog.finest(&quot;Real
                    native focused<br>
                                                                       
                     window: &quot; +<br>
                    <br>
                                realNativeFocusedWindow +<br>
                                &quot;\nKFM&#39;s focused window: &quot; +<br>
                                                         focusedWindow);<br>
                                                                       
                     *...<br>
                                                                       
                     *<br>
                                             focusLog.fine(&quot;Requesting
                    focus to &quot; + (this ==<br>
                                                                       
                     toFocus ? &quot;this<br>
                                                                       
                     window&quot; : toFocus));<br>
                                                                       
                     *...<br>
                                                                       
                     }<br>
                    <br>
                                                                       
                     XBaseWindow:<br>
                                                                       
                          public void<br>
                                xSetBounds(int<br>
                                                         x, int y, int
                    width, int<br>
                                                                       
                     height) {<br>
                                                                       
                     ...<br>
                                                                       
                     *<br>
                                  insLog.fine(&quot;Setting<br>
                                                         bounds on &quot; +
                    this + &quot; to<br>
                                                                       
                     (&quot; + x + &quot;, &quot; +<br>
                                                                       
                     y + &quot;), &quot; + width +<br>
                                &quot;x&quot; + height);<br>
                                                                       
                     *}<br>
                    <br>
                                                                       
                     XNetProtocol:<br>
                                                                       
                          boolean<br>
                                doStateProtocol() {<br>
                                                                       
                     ...<br>
                                                                       
                     *<br>
                  </div>
                </div>
                                         stateLog.finer(&quot;______doStateProtocol()
                returns &quot; +
                <div>
                  <div><br>
                    <br>
                                                                       
                     res);<br>
                                                                       
                     *}<br>
                    <br>
                                                                       
                     XSystemTrayPeer:<br>
                    <br>
                                  XSystemTrayPeer(SystemTray<br>
                                                         target) {<br>
                                                                       
                     ...<br>
                                                                       
                     *        log.fine(&quot;<br>
                                check if<br>
                                                         system tray is
                    available.<br>
                                                                       
                     selection owner:<br>
                                &quot; + selection_owner);<br>
                                                                       
                     *}<br>
                                                                       
                          void<br>
                                                       
                     addTrayIcon(XTrayIconPeer tiPeer)<br>
                                throws<br>
                                                                       
                     AWTException {<br>
                                                                       
                     ...<br>
                                                                       
                     *        log.fine(&quot;<br>
                                send<br>
                                                       
                     SYSTEM_TRAY_REQUEST_DOCK<br>
                                                                       
                     message to owner: &quot; +<br>
                                                                       
                     selection_owner);<br>
                                                                       
                     *}<br>
                    <br>
                                                                       
                     XFramePeer:<br>
                                                                       
                          public void<br>
                                                       
                     handlePropertyNotify(XEvent xev) {<br>
                                                                       
                     ...<br>
                    <br>
                                                 stateLog.finer(&quot;State
                    is the same: &quot; + state);<br>
                                                                       
                     }<br>
                    <br>
                                                                       
                     However I only give<br>
                                here few<br>
                                                         cases but
                    certainly others<br>
                                                                       
                     are still<br>
                                                                       
                     present in the<br>
                                source code;<br>
                                                         maybe findbugs
                    or netbeans<br>
                                                                       
                     warnings could<br>
                                                                       
                     help you finding<br>
                                all of them.<br>
                    <br>
                                                                       
                     I advocate the<br>
                                amount of waste<br>
                                                         (GC) is not
                    very<br>
                                                                       
                     important but String<br>
                                                                       
                     conversion are also<br>
                                calling<br>
                                                         several
                    toString() methods<br>
                                                                       
                     that can be<br>
                                                                       
                     costly (event,<br>
                                Frame, window ...)<br>
                    <br>
                                                                       
                     Finally, I ran few<br>
                                grep commands<br>
                                                         on the
                    sun.awt.X11 code<br>
                                                                       
                     (jdk7u) and you<br>
                                                                       
                     can look at them to<br>
                                see all<br>
                                                         string +
                    operations related<br>
                                                                       
                     to log statements.<br>
                    <br>
                                                                       
                     PS: I may help<br>
                                fixing the source<br>
                                                         code but I have
                    no idea<br>
                                                                       
                     how to<br>
                                                                       
                     collaborate<br>
                                (provide a patch ?)<br>
                    <br>
                                                                       
                     Regards,<br>
                                                                       
                     Laurent Bourgès<br>
                    <br>
                    <br>
                    <br>
                    <br>
                    <br>
                    <br>
                                         --         Best regards,
                    Sergey.<br>
                    <br>
                    <br>
                    <br>
                    <br>
                  </div>
                </div>
              </blockquote>
            </blockquote>
          </div>
          <br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </div></div></div>

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