Class comb.logging.Logger
This class is the entry point for all logging actions in comb.
Logger should be retrieved by calling Logger.getLogger() NOT through the new keyword
All loggers in comb follow a heirarchy of inheritance based on a dot notation.
rootLogger - "" / \ "my" "myOther" / \ "my.logger" "myOther.logger" / \ "my.logger.Log" "myOther.logger.Log"In the above Tree the rootLogger is the base for all logger. my and myOther inherit from rootLogger my.logger inherits from my, and myOther.logger inherits from myOther. The logs do not have to be retrieved in order. If I set rootLogger to ERROR level and added a console appender to it the appender and level will be added to all logs. However if I set my to INFO level and add a fileAppender to it the level and appender will only be added to logs in "my" subtree. If you set my.logger to not be additive then levels, and appenders will not propogate down to the rest of the tree.
For information on levels see comb.logging.Level.
For information on appenders see
- comb.logging.appenders.Appender
- comb.logging.appenders.ConsoleAppender
- comb.logging.appenders.FileAppender
- comb.logging.appenders.JSONAppender
- comb.logging.appenders.RollingFileAppender
For information on configurators see comb.logging.BasicConfigurator or comb.logging.PropertyConfigurator.
Defined in: index.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
set to false to prevent changes to this logger from propogating down.
|
|
list of appenders this logger currently contains.
|
|
the full path name of this Logger.
|
|
true if this Loggers level is DEBUG
|
|
true if this Loggers level is ERROR
|
|
true if this Loggers level is FATAL
|
|
true if this Loggers level is INFO
|
|
true if this Loggers level is OFF
|
|
true if this Loggers level is TRACE
|
|
true if this Loggers level is WARN
|
|
the level of this Logger
|
|
the name of this logger this does not include the dot notated name
|
|
all loggers this logger is the parent of.
|
Method Attributes | Method Name and Description |
---|---|
addAppender(appender)
Add an appender to this logger.
|
|
addAppenders(appenders)
Short cut to add a list of appenders to this Logger
|
|
debug(message)
Log an debug level message
|
|
error(message)
Log an error level message
|
|
fatal(message)
Log an fatal level message
|
|
getAppender(name)
Gets an appender from this logger
|
|
<static> |
comb.logging.Logger.getLogger(name)
Retrieves/Creates a logger based on the name passed in
|
<static> |
comb.logging.Logger.getRootLogger()
Return the root of all loggers
|
info(message)
Log an info level message
|
|
isAppenderAttached(name)
Determines if an appender is attached.
|
|
log(level, message)
Log a message
|
|
Removes all appenders from this logger and sub loggers if this Logger is additive.
|
|
removeAppender(name)
Removes and appender from this logger.
|
|
removeAppenders(appenders)
Removes a list of appenders from this logger.
|
|
trace(message)
Log an trace level message
|
|
warn(message)
Log an warn level message
|
Class Detail
comb.logging.Logger()
var logging = comb.logging, Logger = logging.Logger, appenders = logging.appenders, Level = logging.Level; //configure you logging environement var bc = logging.BasicConfigurator(); //add console appender to all loggers bc.configure(); //add a file appender to all loggers bc.configure(new appenders.FileAppender({file : "/var/log/myLog.log"})); //Retreiving a logger. var combLogger = Logger.getLogger("comb"); var combCollectionLogger = Logger.getLogger("comb.collections"); var treeLogger = Logger.getLogger("comb.collections.Tree"); //set my treeLogger to DEBUG Level treeLogger.level = Level.DEBUG; //add a JSON appender to tree logger just for fun! treeLogger.addAppender(new appenders.JSONAppender({file : "/var/log/myTreeLogger.json"})); //NOW USE THEM
Field Detail
{Boolean}
additive
set to false to prevent changes to this logger from propogating down.
{comb.logging.appenders.Appender}
appenders
list of appenders this logger currently contains.
{String}
fullName
the full path name of this Logger.
{Boolean}
isDebug
true if this Loggers level is DEBUG
{Boolean}
isError
true if this Loggers level is ERROR
{Boolean}
isFatal
true if this Loggers level is FATAL
{Boolean}
isInfo
true if this Loggers level is INFO
{Boolean}
isOff
true if this Loggers level is OFF
{Boolean}
isTrace
true if this Loggers level is TRACE
{Boolean}
isWarn
true if this Loggers level is WARN
{comb.logging.Level}
level
the level of this Logger
{String}
name
the name of this logger this does not include the dot notated name
{Array}
subLoggers
all loggers this logger is the parent of.
Method Detail
addAppender(appender)
Add an appender to this logger. If this is additive then the appender is added to all subloggers.
- Parameters:
- {comb.logging.Appender} appender
- the appender to add.
addAppenders(appenders)
Short cut to add a list of appenders to this Logger
- Parameters:
-
{Array
} appenders
debug(message)
Log an debug level message
- Parameters:
- {String} message
- the message to log.
error(message)
Log an error level message
- Parameters:
- {String} message
- the message to log.
fatal(message)
Log an fatal level message
- Parameters:
- {String} message
- the message to log.
{comb.logging.Appender|undefined}
getAppender(name)
Gets an appender from this logger
- Parameters:
- {String} name
- the name of the appender.
- Returns:
- {comb.logging.Appender|undefined} returns the appender with the specified name or undefined if it is not found.
<static>
comb.logging.Logger.getLogger(name)
Retrieves/Creates a logger based on the name passed in
- Parameters:
- {String} name
- the name of the logger
<static>
comb.logging.Logger.getRootLogger()
Return the root of all loggers
info(message)
Log an info level message
- Parameters:
- {String} message
- the message to log.
isAppenderAttached(name)
Determines if an appender is attached.
- Parameters:
- {String} name
- the name of the appender.
log(level, message)
Log a message
- Parameters:
- {comb.logging.Level} level
- the level the message is
- {String} message
- the message to log.
removeAllAppenders()
Removes all appenders from this logger and sub loggers if this Logger is additive.
removeAppender(name)
Removes and appender from this logger.
- Parameters:
- {String} name
- the name of the appender
removeAppenders(appenders)
Removes a list of appenders from this logger.
- Parameters:
-
{Array
} appenders - a list of names of appenders to remove
trace(message)
Log an trace level message
- Parameters:
- {String} message
- the message to log.
warn(message)
Log an warn level message
- Parameters:
- {String} message
- the message to log.