Programmer Reference : Log4s : The Director: LogManager
The Director: LogManager
The LogManager has the following capabilities:
Creation and management of the main players: Loggers, Appenders, LoggingEvents and their associated filters;
Initialization of the log4s framework;
Global override of logging.
The LogManager is a singleton of the class EsLogManager that provides an easy way to create and manage Loggers, Appenders, LoggingEvents and filters. By default, the LogManager has a logger named 'root.' The rootLogger will be used as the default logger if no other logger is specified. The user can create additional named loggers, but the rootLogger is usually sufficient.
Example in ini file:
createLogger=Vast
Smalltalk code equivalent
EsLogManager createLogger: ‘Vast’.
The LogManager initializes the log4s framework by reading the log4s stanza in the .ini file at image startup and creates the loggers, appenders, and filters that are specified in it. The LogManager keeps track of all the loggers it creates in its instance variable loggers.
Finally, the LogManager provides a global override for logging control. First, it maintains a master global level in its instance variable level which overrides any appender’s level. This global level is set by this line in the ini file:
globalLevel= Warn
Smalltalk code equivalent
EsLogManager singleton level: EsLevel Warn
The logical decision about logging an EsLoggingEvent is expressed by this pseudo code:
(aLoggingEvent level >= EsLogManager level and:
[aLoggingEvent level >= appender level])
The globalLevel is best left set to All. Note that setting it to Off disables all logging.
Second, the logManager can programmatically stop all logging activity, or clear all levels or filters in the log4s framework.
shutDown calls shutDown on all the loggers which then call shutDown on all their appenders who then close any open files and mark themselves as closed. shutDown is called automatically when the image shuts down.
clearLevels calls clearLevels on all the loggers which then call clearLevels on all their appenders who then execute level := EsLevel All.
clearFilters calls clearFilters on all the loggers which then call clearFilters on all their appenders who then execute filters := OrderedCollection new.
 
Last modified date: 12/20/2017