activemq::logger::Logger Class Reference

#include <Logger.h>

List of all members.

Public Member Functions

 Logger (const std::string &name, Logger *parent)
virtual ~Logger (void)
virtual const std::string & getName (void) const
virtual void addHandler (Handler *handler) throw ( exceptions::IllegalArgumentException )
virtual void removeHandler (Handler *handler)
virtual const std::list< Handler * > & getHandlers (void) const
virtual void setFilter (Filter *filter)
virtual const FiltergetFilter (void) const
virtual Level getLevel (void) const
virtual void setLevel (Level level)
virtual bool getUseParentHandlers (void) const
virtual void setUseParentHandlers (bool value)
virtual void entry (const std::string &blockName, const std::string &file, const int line)
virtual void exit (const std::string &blockName, const std::string &file, const int line)
virtual void debug (const std::string &file, const int line, const std::string functionName, const std::string &message)
virtual void info (const std::string &file, const int line, const std::string functionName, const std::string &message)
virtual void warn (const std::string &file, const int line, const std::string functionName, const std::string &message)
virtual void error (const std::string &file, const int line, const std::string fnctionName, const std::string &message)
virtual void fatal (const std::string &file, const int line, const std::string functionName, const std::string &message)
virtual void throwing (const std::string &file, const int line, const std::string fnctionName, const std::string &message)
virtual bool isLoggable (Level level) const
virtual void log (LogRecord &record)
virtual void log (Level level, const std::string &message)
virtual void log (Level level, const std::string &file, const int line, const std::string &message,...)
virtual void log (Level level, const std::string &file, const int line, const std::string &message, cms::CMSException &ex)

Static Public Member Functions

static LoggergetAnonymousLogger (void)
static LoggergetLogger (const std::string &name)

Private Attributes

std::string name
Loggerparent
std::list< Handler * > handlers
Filterfilter
Level level
bool useParentHandlers


Constructor & Destructor Documentation

Logger::Logger const std::string &  name,
Logger parent
 

Creates a new instance of the Logger with the given name and assign it the given parent logger.

The logger will be initially configured with a null Level and with useParentHandlers true.

Parameters:
name - A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as java.net or javax.swing. It may be null for anonymous Loggers.
parent logger that is this one's parent

Logger::~Logger void   )  [virtual]
 


Member Function Documentation

void Logger::addHandler Handler handler  )  throw ( exceptions::IllegalArgumentException ) [virtual]
 

Add a log Handler to receive logging messages.

By default, Loggers also send their output to their parent logger. Typically the root Logger is configured with a set of Handlers that essentially act as default handlers for all loggers.

Parameters:
handler A Logging Handler throws IllegalArgumentException

void Logger::debug const std::string &  file,
const int  line,
const std::string  functionName,
const std::string &  message
[virtual]
 

Log a Debug Level Log

If the logger is currently enabled for the DEBUG message level then the given message is forwarded to all the registered output Handler objects.

Parameters:
file the file name where the log was generated
line the line number where the log was generated
functionName name of the function that logged this
message the message to log

void Logger::entry const std::string &  blockName,
const std::string &  file,
const int  line
[virtual]
 

Logs an Block Enter message

This is a convenience method that is used to tag a block enter, a log record with the class name function name and the string Entering is logged at the DEBUG log level.

Parameters:
blockName source block name
file source file name
line source line name

void Logger::error const std::string &  file,
const int  line,
const std::string  fnctionName,
const std::string &  message
[virtual]
 

Log a error Level Log

If the logger is currently enabled for the error message level then the given message is forwarded to all the registered output Handler objects.

Parameters:
file the file name where the log was generated
line the line number where the log was generated
fnctionName name of the function that logged this
message the message to log

void Logger::exit const std::string &  blockName,
const std::string &  file,
const int  line
[virtual]
 

Logs an Block Exit message

This is a convenience method that is used to tag a block exit, a log record with the class name function name and the string Exiting is logged at the DEBUG log level.

Parameters:
blockName source block name
file source file name
line source line name

void Logger::fatal const std::string &  file,
const int  line,
const std::string  functionName,
const std::string &  message
[virtual]
 

Log a fatal Level Log

If the logger is currently enabled for the fatal message level then the given message is forwarded to all the registered output Handler objects.

Parameters:
file the file name where the log was generated
line the line number where the log was generated
fnctionName name of the function that logged this
message the message to log

Logger * Logger::getAnonymousLogger void   )  [static]
 

Creates an anonymous logger

The newly created Logger is not registered in the LogManager namespace. There will be no access checks on updates to the logger. Even although the new logger is anonymous, it is configured to have the root logger ("") as its parent. This means that by default it inherits its effective level and handlers from the root logger.

The caller is responsible for destroying the returned logger.

Returns:
Newly created anonymous logger

virtual const Filter* activemq::logger::Logger::getFilter void   )  const [inline, virtual]
 

Gets the Filter object that this class is using.

Returns:
the Filter in use, can be null

virtual const std::list<Handler*>& activemq::logger::Logger::getHandlers void   )  const [virtual]
 

Gets a vector containing all the handlers that this class has been assigned to use.

Returns:
a list of handlers that are used by this logger

virtual Level activemq::logger::Logger::getLevel void   )  const [inline, virtual]
 

Get the log Level that has been specified for this Logger. The result may be the Null level, which means that this logger's effective level will be inherited from its parent.

Returns:
the level that is currently set

Logger * Logger::getLogger const std::string &  name  )  [static]
 

Find or create a logger for a named subsystem. If a logger has already been created with the given name it is returned. Otherwise a new logger is created.

If a new logger is created its log level will be configured based on the LogManager and it will configured to also send logging output to its parent loggers Handlers. It will be registered in the LogManager global namespace.

Parameters:
name - A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as cms or activemq.core.ActiveMQConnection
Returns:
a suitable logger.

virtual const std::string& activemq::logger::Logger::getName void   )  const [inline, virtual]
 

Gets the name of this Logger

Returns:
logger name

virtual bool activemq::logger::Logger::getUseParentHandlers void   )  const [inline, virtual]
 

Discover whether or not this logger is sending its output to its parent logger.

Returns:
true if using Parent Handlers

void Logger::info const std::string &  file,
const int  line,
const std::string  functionName,
const std::string &  message
[virtual]
 

Log a info Level Log

If the logger is currently enabled for the info message level then the given message is forwarded to all the registered output Handler objects.

Parameters:
file the file name where the log was generated
line the line number where the log was generated
functionName name of the function that logged this
message the message to log

bool Logger::isLoggable Level  level  )  const [virtual]
 

Check if a message of the given level would actually be logged by this logger. This check is based on the Loggers effective level, which may be inherited from its parent.

Parameters:
level - a message logging level
Returns:
true if the given message level is currently being logged.

void Logger::log Level  level,
const std::string &  file,
const int  line,
const std::string &  message,
cms::CMSException &  ex
[virtual]
 

Log a message, with associated Throwable information. If the logger is currently enabled for the given message level then the given arguments are stored in a LogRecord which is forwarded to all registered output handlers. Note that the thrown argument is stored in the LogRecord thrown property, rather than the LogRecord parameters property. Thus is it processed specially by output Formatters and is not treated as a formatting parameter to the LogRecord message property.

Parameters:
level the Level to log at
file File that the message was logged in
line the line number where the message was logged at.
ex the Exception to log

void Logger::log Level  level,
const std::string &  file,
const int  line,
const std::string &  message,
  ...
[virtual]
 

Log a message, with the list of params that is formatted into the message string.

If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects

Parameters:
level the Level to log at
file the message to log
line the line in the file
variable length arguement to format the message string.

void Logger::log Level  level,
const std::string &  message
[virtual]
 

Log a message, with no arguments.

If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects

Parameters:
level the Level to log at
message the message to log

void Logger::log LogRecord record  )  [virtual]
 

Log a LogRecord. All the other logging methods in this class call through this method to actually perform any logging. Subclasses can override this single method to capture all log activity.

Parameters:
record - the LogRecord to be published

void Logger::removeHandler Handler handler  )  [virtual]
 

Removes the specified Handler and destroys it

Returns silently if the given Handler is not found.

Parameters:
handler The Handler to remove

void Logger::setFilter Filter filter  )  [virtual]
 

Set a filter to control output on this Logger.

After passing the initial "level" check, the Logger will call this Filter to check if a log record should really be published.

The caller releases ownership of this filter to this logger

Parameters:
filter to use, can be null

virtual void activemq::logger::Logger::setLevel Level  level  )  [inline, virtual]
 

Set the log level specifying which message levels will be logged by this logger. Message levels lower than this value will be discarded. The level value Level.OFF can be used to turn off logging.

If the new level is the Null Level, it means that this node should inherit its level from its nearest ancestor with a specific (non-null) level value.

Parameters:
level new Level value

virtual void activemq::logger::Logger::setUseParentHandlers bool  value  )  [inline, virtual]
 

pecify whether or not this logger should send its output to it's parent Logger. This means that any LogRecords will also be written to the parent's Handlers, and potentially to its parent, recursively up the namespace.

Parameters:
value True is output is to be writen to the parent

virtual void activemq::logger::Logger::throwing const std::string &  file,
const int  line,
const std::string  fnctionName,
const std::string &  message
[virtual]
 

Log a Throw Message

If the logger is currently enabled for the Throwing message level then the given message is forwarded to all the registered output Handler objects.

Parameters:
file the file name where the log was generated
line the line number where the log was generated
fnctionName name of the function that logged this
message the message to log

void Logger::warn const std::string &  file,
const int  line,
const std::string  functionName,
const std::string &  message
[virtual]
 

Log a warn Level Log

If the logger is currently enabled for the warn message level then the given message is forwarded to all the registered output Handler objects.

Parameters:
file the file name where the log was generated
line the line number where the log was generated
functionName name of the function that logged this
message the message to log


Member Data Documentation

Filter* activemq::logger::Logger::filter [private]
 

std::list<Handler*> activemq::logger::Logger::handlers [private]
 

Level activemq::logger::Logger::level [private]
 

std::string activemq::logger::Logger::name [private]
 

Logger* activemq::logger::Logger::parent [private]
 

bool activemq::logger::Logger::useParentHandlers [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Aug 3 18:03:33 2006 for activemq-cpp by  doxygen 1.4.5