Holger's
Java API

com.antelmann.util.logging
Class XMLLogWriter

java.lang.Object
  extended by com.antelmann.util.logging.AbstractLogWriter<String>
      extended by com.antelmann.util.logging.XMLLogWriter
All Implemented Interfaces:
Filter<LogEntry>, LogWriter, Closeable
Direct Known Subclasses:
EmailWriter

public class XMLLogWriter
extends AbstractLogWriter<String>
implements Closeable

writes LogEntry objects formatted as XML to either a PrintStream or PrintWriter. As the XMLLogWriter uses a PrintStream/PrintWriter to write the log entries, no exception is thrown during logging. You'll have to check the PrintStream/PrintWriter object to check for errors.

Author:
Holger Antelmann
See Also:
XMLLogFormatter

Field Summary
 
Fields inherited from class com.antelmann.util.logging.AbstractLogWriter
filter
 
Fields inherited from interface com.antelmann.util.Filter
EXCLUDE_ALL_FILTER, INCLUDE_ALL_FILTER
 
Constructor Summary
XMLLogWriter(PrintStream ps)
           
XMLLogWriter(PrintWriter pw)
           
 
Method Summary
 void close()
           
 void flush()
          only needed if getAlwaysFlush() returns false
 boolean getAlwaysFlush()
          true by default
 PrintStream getPrintStream()
           
 PrintWriter getPrintWriter()
           
 void setAlwaysFlush(boolean flag)
           
 void writeLogPattern(String pattern)
          writes the pattern to the log entity.
 
Methods inherited from class com.antelmann.util.logging.AbstractLogWriter
accept, getLogFilter, getLogFormatter, setLogFilter, setLogFormatter, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLLogWriter

public XMLLogWriter(PrintStream ps)

XMLLogWriter

public XMLLogWriter(PrintWriter pw)
Method Detail

getPrintStream

public PrintStream getPrintStream()

getPrintWriter

public PrintWriter getPrintWriter()

flush

public void flush()
only needed if getAlwaysFlush() returns false


setAlwaysFlush

public void setAlwaysFlush(boolean flag)

getAlwaysFlush

public boolean getAlwaysFlush()
true by default


writeLogPattern

public void writeLogPattern(String pattern)
Description copied from class: AbstractLogWriter
writes the pattern to the log entity. If the LogEntryFormatter is null, the pattern is the LogEntry object itself; otherwise, the pattern is the result of formatting the LogEntry with the given LogEntryFormatter.

Specified by:
writeLogPattern in class AbstractLogWriter<String>

close

public void close()
Specified by:
close in interface Closeable


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads