activemq-cpp-3.9.0
|
Stream based logging Handler. More...
#include <src/main/decaf/util/logging/StreamHandler.h>
Public Member Functions | |
StreamHandler () | |
Create a StreamHandler, with no current output stream. More... | |
StreamHandler (decaf::io::OutputStream *stream, Formatter *formatter) | |
Create a StreamHandler, with no current output stream. More... | |
virtual | ~StreamHandler () |
virtual void | close () |
Close the current output stream. More... | |
virtual void | flush () |
Flush the Handler's output, clears any buffers. More... | |
virtual void | publish (const LogRecord &record) |
Publish the Log Record to this Handler. More... | |
virtual bool | isLoggable (const LogRecord &record) const |
Check if this Handler would actually log a given LogRecord. More... | |
![]() | |
Handler () | |
virtual | ~Handler () |
virtual void | setFilter (Filter *filter) |
Sets the Filter that this Handler uses to filter Log Records. More... | |
virtual Filter * | getFilter () |
Gets the Filter that this Handler uses to filter Log Records. More... | |
virtual void | setLevel (const Level &value) |
Set the log level specifying which message levels will be logged by this Handler. More... | |
virtual Level | getLevel () |
Get the log level specifying which message levels will be logged by this Handler. More... | |
virtual void | setFormatter (Formatter *formatter) |
Sets the Formatter used by this Handler. More... | |
virtual Formatter * | getFormatter () |
Gets the Formatter used by this Handler. More... | |
virtual void | setErrorManager (ErrorManager *errorManager) |
Sets the Formatter used by this Handler. More... | |
virtual ErrorManager * | getErrorManager () |
Gets the ErrorManager used by this Handler. More... | |
![]() | |
virtual | ~Closeable () |
Protected Member Functions | |
virtual void | setOuputStream (decaf::io::OutputStream *stream) |
Change the output stream. More... | |
void | close (bool closeStream) |
Closes this handler, but the underlying output stream is only closed if closeStream is true. More... | |
![]() | |
void | reportError (const std::string &message, decaf::lang::Exception *ex, int code) |
Protected convenience method to report an error to this Handler's ErrorManager. More... | |
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::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 |
|
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.
IOException | if an I/O error occurs. |
Implements decaf::io::Closeable.
Reimplemented in decaf::util::logging::ConsoleHandler.
|
protected |
Closes this handler, but the underlying output stream is only closed if closeStream is true.
closeStream | whether to close the underlying output stream. |
|
virtual |
Flush the Handler's output, clears any buffers.
Implements decaf::util::logging::Handler.
|
virtual |
Check if this Handler would actually log a given LogRecord.
record | LogRecord to check |
Reimplemented from decaf::util::logging::Handler.
Publish the Log Record to this Handler.
record | The LogRecord to Publish |
Implements decaf::util::logging::Handler.
Reimplemented in decaf::util::logging::ConsoleHandler.
|
protectedvirtual |
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.
stream | The new output stream. May not be NULL. |
NullPointerException | if the passed stream is NULL. |