ATLAS Offline Software
Loading...
Searching...
No Matches
trfLogger.py
Go to the documentation of this file.
1# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
14
15import logging
16import logging.config as lconfig
17import os
18import sys
19
20
23msg = logging.getLogger('PyJobTransforms')
24
25
27stdLogLevels = {'DEBUG' : logging.DEBUG,
28 'VERBOSE' : logging.DEBUG,
29 'INFO' : logging.INFO,
30 'WARNING' : logging.WARNING,
31 'ERROR' : logging.ERROR,
32 'CRITICAL' : logging.CRITICAL,
33 'FATAL' : logging.CRITICAL,
34 'CATASTROPHE' : logging.CRITICAL+10, # Special prority level to ensure an error is
35 # elevated to be the exitMsg
36 }
37
38
39stdLogLevelsByCritcality = ['FATAL', 'CRITICAL', 'ERROR', 'WARNING', 'INFO', 'VERBOSE', 'DEBUG']
40
41# If TRF_LOGCONF is defined then try to use that file
42# for logging setup
43if 'TRF_LOGCONF' in os.environ and os.access(os.environ['TRF_LOGCONF'], os.R_OK):
44 lconfig.fileConfig(os.environ['TRF_LOGCONF'])
45else:
46 # Otherwise use a standard logging configuration
47 hdlr = logging.StreamHandler(sys.stdout)
48 # asctime seems too verbose...?
49 frmt = logging.Formatter("%(name)s.%(funcName)s %(asctime)s %(levelname)s %(message)s")
50# frmt = logging.Formatter("Trf:%(name)s.%(funcName)s %(levelname)s %(message)s")
51 hdlr.setFormatter(frmt)
52 msg.addHandler(hdlr)
53 msg.setLevel(logging.INFO)
54
55
57 msg.setLevel(level)
setRootLoggerLevel(level)
Change the loggging level of the root logger.
Definition trfLogger.py:56