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]

Reply via email to