LoggingRoot

Logging Root

class DIRAC.FrameworkSystem.private.standardLogging.LoggingRoot.LoggingRoot

Bases: DIRAC.FrameworkSystem.private.standardLogging.Logging.Logging

LoggingRoot is a Logging object and it is particular because it is the first parent of the chain. In this context, it has more possibilities because it is the one that initializes the logger of the standard logging library and it configures it with the configuration.

There is a difference between the parent Logging and the other because the parent defines the behaviour of all the Logging objects, so it needs a specific class.

LoggingRoot has to be unique, because we want one and only one parent on the top of the chain: that is why we created a singleton to keep it unique.

always(sMsg, sVarMsg='')

Always level

debug(sMsg, sVarMsg='')

Debug level

disableLogsFromExternalLibs()

Disable the display of the logs coming from external libraries

enableLogsFromExternalLibs()

Enable the display of the logs coming from external libraries

error(sMsg, sVarMsg='')

Error level

exception(sMsg='', sVarMsg='', lException=False, lExcInfo=False)

Exception level

fatal(sMsg, sVarMsg='')

Fatal level

flushAllMessages(exitCode=0)

flushAllMessages: Deleted method. Do not use it.

static getAllPossibleLevels()
Returns:a list of all levels available
getDisplayOptions()
Returns:the dictionary of the display options and their values. Must not be redefined
getLevel()
Returns:the name of the level
classmethod getName()
Returns:“system name/component name”
getSubLogger(subName, child=True)

Create a new Logging object, child of this Logging, if it does not exists.

Params subName:the name of the child Logging
getSubName()
Returns:the name of the logger
info(sMsg, sVarMsg='')

Info level

initialize(systemName, cfgPath, forceInit=False)

Configure the root Logging. It can be possible to : - attach it some backends : LogBackends = stdout,stderr,file,server - attach backend options : BackendOptions { FileName = /tmp/file.log } - add colors and the path of the call : LogColor = True, LogShowLine = True - precise a level : LogLevel = DEBUG

Params systemName:
 string represented as “system name/component name”
Params cfgPath:string of the configuration path
Params forceInit:
 Force the initialization even if it had already happened. This should not be used !! The only case is LocalConfiguration.enableCS In order to take into account extensions’ backends
initialized()

initialized: Deleted method. Do not use it.

instance = <DIRAC.FrameworkSystem.private.standardLogging.LoggingRoot.LoggingRoot object>
notice(sMsg, sVarMsg='')

Notice level

processMessage(messageObject)

processMessage: Deleted method. Do not use it.

registerBackend(desiredBackend, backendOptions=None)

Attach a backend to the Logging object. Convert backend name to backend class name to a Backend object and add it to the Logging object

Params desiredBackend:
 a name attaching to a backend type. list of the possible values: [‘stdout’, ‘stderr’, ‘file’, ‘server’]
Params backendOptions:
 dictionary of different backend options. example: FileName=’/tmp/log.txt’
registerBackends(desiredBackends, backendOptions=None)

Attach a list of backends to the Logging object. Convert backend name to backend class name to a Backend object and add it to the Logging object

Params desiredBackends:
 a list of different names attaching to differents backends. list of the possible values: [‘stdout’, ‘stderr’, ‘file’, ‘server’]
Params backendOptions:
 dictionary of different backend options. example: FileName=’/tmp/log.txt’
setLevel(levelName)

Check if the level name exists and get the integer value before setting it.

Params levelName:
 string representing the level to give to the logger
Returns:boolean representing if the setting is done or not
showHeaders(yesno=True)

Depending on the value, display or not the prefix of the message.

Params yesno:boolean determining the behaviour of the display
showStack()

Display a debug message without any content.

Returns:boolean, True if the message is sent, else False
showThreadIDs(yesno=True)

Depending on the value, display or not the thread ID.

Params yesno:boolean determining the behaviour of the display
shown(levelName)

Determine if messages with a certain level will be displayed or not.

Params levelName:
 string representing the level to analyse
Returns:boolean which give the answer
verbose(sMsg, sVarMsg='')

Verbose level

warn(sMsg, sVarMsg='')

Warn