decaf::util::logging::StreamHandler Class Reference

Stream based logging Handler. More...

#include <src/main/decaf/util/logging/StreamHandler.h>

Inheritance diagram for decaf::util::logging::StreamHandler:
Inheritance graph
[legend]

Public Member Functions

 StreamHandler ()
 Create a StreamHandler, with no current output stream.
 StreamHandler (decaf::io::OutputStream *stream, Formatter *formatter)
 Create a StreamHandler, with no current output stream.
virtual ~StreamHandler ()
virtual void close ()
 Close the current output stream.
virtual void flush ()
 Flush the Handler's output, clears any buffers.
virtual void publish (const LogRecord &record)
 Publish the Log Record to this Handler.
virtual bool isLoggable (const LogRecord &record) const
 Check if this Handler would actually log a given LogRecord.

Protected Member Functions

virtual void setOuputStream (decaf::io::OutputStream *stream)
 Change the output stream.
void close (bool closeStream)
 Closes this handler, but the underlying output stream is only closed if closeStream is true.

Detailed Description

Stream based logging Handler.

This is primarily intended as a base class or support class to be used in implementing other logging Handlers.

LogRecords are published to a given decaf::io::OutputStream.

Configuration: By default each StreamHandler is initialized using the following LogManager configuration properties. If properties are not defined (or have invalid values) then the specified default values are used.

* decaf.util.logging.StreamHandler.level specifies the default level for the Handler (defaults to Level.INFO). * decaf.util.logging.StreamHandler.filter specifies the name of a Filter class to use (defaults to no Filter). * decaf.util.logging.StreamHandler.formatter specifies the name of a Formatter class to use (defaults to decaf.util.logging.SimpleFormatter).

Since:
1.0

Constructor & Destructor Documentation

decaf::util::logging::StreamHandler::StreamHandler (  ) 

Create a StreamHandler, with no current output stream.

decaf::util::logging::StreamHandler::StreamHandler ( decaf::io::OutputStream stream,
Formatter formatter 
)

Create a StreamHandler, with no current output stream.

virtual decaf::util::logging::StreamHandler::~StreamHandler (  )  [virtual]

Member Function Documentation

void decaf::util::logging::StreamHandler::close ( bool  closeStream  )  [protected]

Closes this handler, but the underlying output stream is only closed if closeStream is true.

Parameters:
closeStream whether to close the underlying output stream.
virtual void decaf::util::logging::StreamHandler::close (  )  [virtual]

Close the current output stream.

The close method will perform a flush and then close the Handler. After close has been called this Handler should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.

Exceptions:
IOException if an I/O error occurs.

Implements decaf::io::Closeable.

Reimplemented in decaf::util::logging::ConsoleHandler.

virtual void decaf::util::logging::StreamHandler::flush (  )  [virtual]

Flush the Handler's output, clears any buffers.

Implements decaf::util::logging::Handler.

virtual bool decaf::util::logging::StreamHandler::isLoggable ( const LogRecord record  )  const [virtual]

Check if this Handler would actually log a given LogRecord.

Parameters:
record LogRecord to check
Returns:
true if the record can be logged with current settings.

Reimplemented from decaf::util::logging::Handler.

virtual void decaf::util::logging::StreamHandler::publish ( const LogRecord record  )  [virtual]

Publish the Log Record to this Handler.

Parameters:
record The LogRecord to Publish

Implements decaf::util::logging::Handler.

Reimplemented in decaf::util::logging::ConsoleHandler.

virtual void decaf::util::logging::StreamHandler::setOuputStream ( decaf::io::OutputStream stream  )  [protected, virtual]

Change the output stream.

If there is a current output stream then the Formatter's tail string is written and the stream is flushed and closed. Then the output stream is replaced with the new output stream.

Parameters:
stream The new output stream. May not be NULL.
Exceptions:
NullPointerException if the passed stream is NULL.

The documentation for this class was generated from the following file:

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1