{"id":265,"date":"2011-05-03T16:39:25","date_gmt":"2011-05-03T16:39:25","guid":{"rendered":"https:\/\/kari.world.ikari.fi\/2011\/05\/03\/duh-dont-now-keep-going-on\/"},"modified":"2011-05-03T16:39:25","modified_gmt":"2011-05-03T16:39:25","slug":"duh-dont-now-keep-going-on","status":"publish","type":"post","link":"https:\/\/kari.world.ikari.fi\/?p=265","title":{"rendered":"Duh, Don&#8217;t, now keep going on&#8230;"},"content":{"rendered":"<p>Seemingly there is eeny-weeny little things what could be optimized in Log4J.<\/p>\n<p><a href=\"http:\/\/comments.gmane.org\/gmane.comp.jakarta.log4j.devel\/13622\">Re: Proposed synchronization changes<\/a><br \/>\n<a href=\"http:\/\/www.mail-archive.com\/log4j-dev@logging.apache.org\/msg09217.html\">log4j-dev<\/a><br \/>\n<a href=\"http:\/\/mail-archives.apache.org\/mod_mbox\/logging-log4j-user\/200512.mbox\/%3C84fb18c70512020839u5ec4ef5agb620bd8f1e30ae86@mail.gmail.com%3E\">Re: log4j multithreading performance<\/a><br \/>\n<a href=\"http:\/\/marc.info\/?l=log4j-dev&amp;m=121094844328808&amp;w=2\">Proposed synchronization changes<\/a><\/p>\n<p>By quickly looking, changes make sense, only one detail strikes me as potential problem: new logic is causing re-allocation of StringBuffer iin PatternLayout, everytime when formatting of layout is done (== every logged event). That may cause undesired gc behaviour in young generation.<\/p>\n<p><strong>References<\/strong><br \/>\n<a href=\"http:\/\/logging.apache.org\/log4j\/1.2\/download.html\">Log4J<\/a><\/p>\n<p><b>Update: 1.6.2011<\/b><br \/>\nIf starting logging now, better to consider successor of Log4j <a href=\"http:\/\/logback.qos.ch\/\">Logback<\/a>. Compared to Log4J, Logback offers some optimizations, like reduced overhead in &#8221;isDebugEnabled()&#8221; checks (<a href=\"http:\/\/www.qos.ch\/pipermail\/logback-user\/2007-March\/000160.html\">19ns vs. 10ns<\/a>), however, that difference isn&#8217;t as drastic as you think, unless you&#8217;ve placed debug traces inside very tight loop (which anyways, isn&#8217;t adviseable). So performance benefit on that case isn&#8217;t reason to switch. Additionally, Logback supports special &#8221;parametrized debug call&#8221;, which seems to be performance wise in the range of Log4J performance with &#8221;isDebugEnabled()&#8221;. However, after investigating more deeply, this &#8221;parametrized&#8221; logging API isn&#8217;t as marvellous as you think, since it has showstopper problems. Namely, it doesn&#8217;t support varargs (one arg, 2 args, Object[], that can be real nuisance), and also it doesn&#8217;t work at all, if you want to trace exception (this is clear showstopper). So it&#8217;s sounds more like API, which would have required more thought before publishing it. At cons side, Logback has also lost convenient properties file based configuration API.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Seemingly there is eeny-weeny little things what could be optimized in Log4J. Re: Proposed synchronization changes log4j-dev Re: log4j multithreading performance Proposed synchronization changes By quickly looking, changes make sense, only one detail strikes me as potential problem: new logic is causing re-allocation of StringBuffer iin PatternLayout, everytime when formatting of layout is done (==&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-265","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts\/265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=265"}],"version-history":[{"count":0,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts\/265\/revisions"}],"wp:attachment":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}