{"id":139,"date":"2008-10-20T06:05:24","date_gmt":"2008-10-20T11:05:24","guid":{"rendered":"http:\/\/www.visophyte.org\/blog\/?p=139"},"modified":"2009-04-01T08:35:18","modified_gmt":"2009-04-01T13:35:18","slug":"log4moz-and-chainsaw-via-new-xmlformattersocketappender","status":"publish","type":"post","link":"https:\/\/www.visophyte.org\/blog\/2008\/10\/20\/log4moz-and-chainsaw-via-new-xmlformattersocketappender\/","title":{"rendered":"Log4Moz and Chainsaw (via new XMLFormatter\/SocketAppender)"},"content":{"rendered":"<p><a href=\"https:\/\/wiki.mozilla.org\/Labs\/JS_Modules#Logging\">Log4Moz<\/a>, the premier mozilla-centric javascript logging framework has just gotten more&#8230; premier.<\/p>\n<p><img decoding=\"async\" title=\"Chainsaw! With Gloda debug output!\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2008\/10\/chainsaw-1.png\" alt=\"A picture of chainsaw with gloda\" \/><\/p>\n<p>By hooking Log4Moz up to <a href=\"http:\/\/logging.apache.org\/chainsaw\/\">Chainsaw<\/a>, Apache log4j&#8217;s pretty UI, we get a UI with some powerful features.\u00a0 Namely, you can filter based on message text (using a regex even), level, source, etc.\u00a0 Also, you can colorize the entries using the same expression mechanism.\u00a0 In the screenshot below, you can see I have filtered to show only the messages with the word &#8220;noun&#8221; on them, and changed the background color of messages with &#8220;+++&#8221; in them.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2008\/10\/chainsaw-2.png\" alt=\"Chainsaw! Gloda! Filters!\" \/><\/p>\n<p>The enhancements made to Log4Moz are to provide an XMLFormatter that rolls in a similar fashion to log4j&#8217;s XMLLayout and a SocketAppender that never forgets&#8230; to kill!\u00a0 And by kill, I mean establish TCP connections.<\/p>\n<p>If you are a gloda user and upgraded to the version I told you to expressly not upgrade to, then you can use this new functionality by creating a file &#8220;\/tmp\/chainsaw.ptr&#8221; with the contents &#8220;localhost:4448&#8221;.\u00a0 Run Chainsaw, create an XMLSocketReceiver, and Bob&#8217;s your uncle.\u00a0 Unfortunately, Bob is not your uncle when it comes to building chainsaw.\u00a0 While maven no longer entirely angries up my blood, the process still leaves something to be desired.\u00a0 (Using this <a href=\"http:\/\/www.visophyte.org\/blog\/wp-content\/uploads\/2008\/10\/settings.xml\">~\/.m2\/settings.xml<\/a> with &#8220;-P default&#8221; may take fewer years off your life if you take <a href=\"http:\/\/logging.apache.org\/chainsaw\/source-repository.html\">this path<\/a>.)<\/p>\n<p>These enhancements are <a href=\"http:\/\/hg.mozilla.org\/users\/bugmail_asutherland.org\/gloda\/file\/19f6ee39f3be\/modules\/log4moz.js\">currently in the gloda repository<\/a>, and perhaps will make their way back upstream or what not?\u00a0 (Land them quick, before I add all forms of crazy helpers like JSON-ing extra arguments and sending them across the wire too!)<\/p>\n<p>UPDATE: Of course, it&#8217;s always a good idea to <a href=\"http:\/\/hg.mozilla.org\/users\/bugmail_asutherland.org\/gloda\/file\/tip\/modules\/log4moz.js\">pull from the tip<\/a>, as the revision linked above had a bit of foolishness with timeouts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Log4Moz, the premier mozilla-centric javascript logging framework has just gotten more&#8230; premier. By hooking Log4Moz up to Chainsaw, Apache log4j&#8217;s pretty UI, we get a UI with some powerful features.\u00a0 Namely, you can filter based on message text (using a &hellip; <a href=\"https:\/\/www.visophyte.org\/blog\/2008\/10\/20\/log4moz-and-chainsaw-via-new-xmlformattersocketappender\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7,3],"tags":[53,22,52],"class_list":["post-139","post","type-post","status-publish","format-standard","hentry","category-debugging","category-mozilla","tag-chainsaw","tag-log4moz","tag-logging"],"_links":{"self":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/comments?post=139"}],"version-history":[{"count":6,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":266,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/posts\/139\/revisions\/266"}],"wp:attachment":[{"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/media?parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/categories?post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.visophyte.org\/blog\/wp-json\/wp\/v2\/tags?post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}