new SimpleLoggerProvider()
Empty constructor for SimpleLoggerProvider.
Extends
Method Summary
- addLoggerAppender
- Adds a SimpleLogAppender to this SimpleLoggerProvider instance.
- dispatchLog
- Publish a log message on all SimpleLogAppender object instances added to this SimpleLoggerProvider so far.
- getLogger
- Logger factory that gets a logger related to a specified category name.
- removeLoggerAppender
- Removes a SimpleLogAppender from this SimpleLoggerProvider instance.
Method Detail
-
addLoggerAppender(logAppender)
-
Adds a SimpleLogAppender to this SimpleLoggerProvider instance. Such appender will receive log lines from the Logger instances generated by this SimpleLoggerProvider instance. The appender defines a category and a threshold level, so that it will receive only the log lines with a level equal to or greater than the threshold and only from the Logger associated with the requested category.
Appenders can be added at any time; any loggers already created by this SimpleLoggerProvider instance will start using the new appender. Until the first appender is added, all log will be discarded.Parameters:
Name Type Description logAppender
SimpleLogAppender An instance of SimpleLogAppender that will consume the log. -
dispatchLog(category, level, mex)
-
Publish a log message on all SimpleLogAppender object instances added to this SimpleLoggerProvider so far.
Parameters:
Name Type Description category
String The category name that produced the given message. level
String The logging level of the given message. It should be one of DEBUG INFO WARN ERROR FATAL constants values. mex
* The message to be logged. It could be a String instance, an Error instance or any other object, provided that it has a toString method. -
getLogger(category) → {Logger}
-
Logger factory that gets a logger related to a specified category name. If such logger does not exist it is created. A unique instance is always maintained for each logger name. This method can potentially cause a memory leak as once a Logger is created it will never be dismissed. It is expected that the number of categories within a single application is somewhat limited and in any case not growing with time.
Parameters:
Name Type Description category
String The name of the desired log category. - Overrides:
Returns:
The desired Logger instance.- Type
- Logger
-
removeLoggerAppender(logAppender)
-
Removes a SimpleLogAppender from this SimpleLoggerProvider instance.
Appenders can be removed at any time.Parameters:
Name Type Description logAppender
SimpleLogAppender An instance of SimpleLogAppender that was previously added to this SimpleLoggerProvider instance.