Scott, again...thanks.
mp "Scott Deboy" <[EMAIL PROTECTED]> 10/28/2005 11:58 AM Please respond to "Log4J Users List" <[email protected]> To "Log4J Users List" <[email protected]> cc Subject RE: Chainsaw Config help request In order for Chainsaw to automatically load any events on startup, a receiver has to do the work of getting the events to Chainsaw. To process an xml-formatted logfile on startup, you need a receiver that knows how to process the XMLLayout-formatted events in the log file. The receiver I described below isn't a dynamic listener (it's not tailing the log file) - it just processes the events in a log file and forwards the events on to any thing that wants to process the events (Chainsaw). Scott -----Original Message----- From: Michael Pitoniak [mailto:[EMAIL PROTECTED] Sent: Friday, October 28, 2005 8:53 AM To: Log4J Users List Subject: RE: Chainsaw Config help request Scott, So many thanks. All i really need is a way for chainsaw to load a pre existing xml file on startup, not a dynamic listener. Is there an easy way t do just that? thanks again. mike "Scott Deboy" <[EMAIL PROTECTED]> 10/28/2005 11:20 AM Please respond to "Log4J Users List" <[email protected]> To "Log4J Users List" <[email protected]> cc Subject RE: Chainsaw Config help request I don't have the time to write the receiver myself, but it's really easy to do using the log4j 1.3 org.apache.log4j.xml.XMLDecoder. You can still use your new receiver with the existing WebStart-available version of Chainsaw at http://logging.apache.org/log4j/docs/chainsaw.html. Here is what you would need to do: - create a new class that extends org.apache.log4j.plugins.Receiver, maybe called LogFileXMLReceiver - add necessary setters/getters (for example, fileURL) to the receiver - in activateOptions, start a new thread that processes the events (logic below) - jar up the new classes - add the jar to $user.home/.chainsaw/plugins - modify your Chainsaw xml config file to include a 'plugin' section specifying this new receiver and required params - start Chainsaw via web start - in view-show application wide preferences, check the 'OK to remove SecurityManager box' (allows Chainsaw to load the new jar from plugins directory) - in this same screen, under automatic configuration url, specify the URL to your config file that includes your new receiver - restart Chainsaw - post the source back to the log4j dev list so we can add it as a contribution to log4j 1.3 Here is the logic you'd use in the new thread that processes the events: XMLDecoder decoder = new XMLDecoder(); Collection c; try { c = decoder.decode(new URL(fileURL); for (Iterator iter = c.iterator();iter.hasNext();) { doPost((LoggingEvent)iter.next()); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Hope this helps, Scott -----Original Message----- From: Michael Pitoniak [mailto:[EMAIL PROTECTED] Sent: Friday, October 28, 2005 7:49 AM To: [email protected] Subject: Chainsaw Config help request team, can someone tell me how to configure chainsaw V2 to automatically load an XML file on startup? many thanks, mike --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
