Syslog White Paper FAQ Examples JavaDoc Classloader
Protomatter Software v1.1.7

com.protomatter.syslog.xml
Class SyslogXML

java.lang.Object
  |
  +--com.protomatter.syslog.xml.SyslogXML

public class SyslogXML
extends java.lang.Object

A utility class for configuring Syslog from an XML file.


Method Summary
static boolean configure(org.jdom.Element syslogConfig)
          Configure syslog from the given XML document.
static void configure(java.io.File xmlFile)
          Configure syslog from the given XML file.
static void configure(java.io.File xmlFile, java.lang.String saxDriverClass)
          Configure syslog from the given XML file using the given JDom SAX driver class as a parser.
static void configure(java.io.InputStream input)
          Configure syslog from the given XML file.
static void configure(java.io.InputStream input, java.lang.String saxDriverClass)
          Configure syslog from the given XML file using the given JDom SAX driver class as a parser.
static org.jdom.Document getConfiguration()
          Get an XML representation of the current configuration state of Syslog including all loggers, etc.
static void main(java.lang.String[] args)
          Write an example XML configuration file to standard out.
static void writeConfiguration(java.io.OutputStream out)
          Get an XML representation of the current configuration state of Syslog including all loggers, etc and write it to the given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeConfiguration

public static void writeConfiguration(java.io.OutputStream out)
                               throws java.io.IOException
Get an XML representation of the current configuration state of Syslog including all loggers, etc and write it to the given output stream.

getConfiguration

public static org.jdom.Document getConfiguration()
Get an XML representation of the current configuration state of Syslog including all loggers, etc.

configure

public static void configure(java.io.File xmlFile)
                      throws SyslogInitException
Configure syslog from the given XML file. The root element of the file must either be a <Syslog> tag, or it must contain a child that is a <Syslog> tag.

By default, this method will use the default SAX parser to parse the configuration file using JDom. If you wish to change the parser, you can specify the "Syslog.xml.parser" system property. That property should be set to the fully qualified class name of a SAX parser, such as "org.apache.xerces.parsers.SAXParser".

See Also:
configure(Element element)

configure

public static void configure(java.io.InputStream input)
                      throws SyslogInitException
Configure syslog from the given XML file. The root element of the file must either be a <Syslog> tag, or it must contain a child that is a <Syslog> tag.

By default, this method will use the default SAX parser to parse the configuration file using JDom. If you wish to change the parser, you can specify the "Syslog.xml.parser" system property. That property should be set to the fully qualified class name of a SAX parser, such as "org.apache.xerces.parsers.SAXParser".

See Also:
configure(Element element)

configure

public static void configure(java.io.File xmlFile,
                             java.lang.String saxDriverClass)
                      throws SyslogInitException
Configure syslog from the given XML file using the given JDom SAX driver class as a parser. The driver class is given as a parameter to the constructor for a org.jdom.input.SAXBuilder object. For instance, to use the Apache Xerces parser, pass in "org.apache.xerces.parsers.SAXParser" as the driver.
See Also:
configure(Element element)

configure

public static void configure(java.io.InputStream input,
                             java.lang.String saxDriverClass)
                      throws SyslogInitException
Configure syslog from the given XML file using the given JDom SAX driver class as a parser. The driver class is given as a parameter to the constructor for a org.jdom.input.SAXBuilder object. For instance, to use the Apache Xerces parser, pass in "org.apache.xerces.parsers.SAXParser" as the driver.
See Also:
configure(Element element)

configure

public static boolean configure(org.jdom.Element syslogConfig)
                         throws SyslogInitException
Configure syslog from the given XML document. The document should look like this:



  <Syslog
    defaultMask="DefaultSyslogLogMask"
    hostname="LocalHostName"
    flushThreadInterval="milliseconds"
  >

    <Logger
      name="LoggerName"
      class="LoggerClassName"
    >
      <!-- Logger directives -->
    </Logger>

    <!-- More loggers here -->

  </Syslog>
  

Each logger is loaded and configured with it's Logger XML element. See the Javadoc for individual loggers for more information.

The default, system-wide log mask is set to be "at or above" the value of the defaultMask attribute (if present). The hostname that Syslog thinks is "local" is set to the value of the hostname attribute (if present).

If the flushThreadInterval attribute is set, it is interpreted as the number of milliseconds for a background thread to sleep between attempts to flush all the loggers.

See Also:
BasicLogger

main

public static final void main(java.lang.String[] args)
Write an example XML configuration file to standard out. The optional first command line argument is a filename to load as a configuration and then print to standard out. This can be useful, as all the default values are populated (which may not have been present in the input file).
See Also:
configure(Element element)

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.7 http://protomatter.sourceforge.net/1.1.7