Python logging.config.dictConfig() Examples
The following are 12
code examples of logging.config.dictConfig().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
logging.config
, or try the search function
.
Example #1
Source File: common_util.py From monasca-analytics with Apache License 2.0 | 6 votes |
def setup_logging(filename): """Setup logging based on a json string. :type filename: str :param filename: Log configuration file. :raises: IOError -- If the file does not exist. :raises: ValueError -- If the file is an invalid json file. """ try: config = parse_json_file(filename) log_conf.dictConfig(config) logpy4j = logging.getLogger("py4j") logpy4j.setLevel(logging.ERROR) logkafka = logging.getLogger("kafka") logkafka.setLevel(logging.ERROR) except (IOError, ValueError): raise
Example #2
Source File: log.py From TraceAnalysis with MIT License | 5 votes |
def logger(): log_conf.dictConfig(log_config) return logging.getLogger(config.LOG_LEVEL)
Example #3
Source File: logs.py From clusterfuzz with Apache License 2.0 | 5 votes |
def configure(name, extras=None): """Set logger. See the list of loggers in bot/config/logging.yaml. Also configures the process to log any uncaught exceptions as an error. |extras| will be included by emit() in log messages.""" suppress_unwanted_warnings() if _is_running_on_app_engine(): configure_appengine() return if _console_logging_enabled(): logging.basicConfig() else: config.dictConfig(get_logging_config_dict(name)) logger = logging.getLogger(name) logger.setLevel(logging.INFO) set_logger(logger) # Set _default_extras so they can be used later. if extras is None: extras = {} global _default_extras _default_extras = extras # Install an exception handler that will log an error when there is an # uncaught exception. sys.excepthook = uncaught_exception_handler
Example #4
Source File: run.py From monasca-analytics with Apache License 2.0 | 5 votes |
def setup_logging(filename): """Setup logging based on a json string.""" with open(filename, "rt") as f: config = json.load(f) log_conf.dictConfig(config)
Example #5
Source File: config_dsl.py From monasca-analytics with Apache License 2.0 | 5 votes |
def setup_logging(): current_dir = os.path.dirname(__file__) logging_config_file = os.path.join(current_dir, DEFAULT_LOGGING_CONFIG_FILE) with open(logging_config_file, "rt") as f: config = json.load(f) log_conf.dictConfig(config)
Example #6
Source File: __init__.py From MDT with GNU Lesser General Public License v3.0 | 5 votes |
def reset_logging(): """Reset the logging to reflect the current configuration. This is commonly called after updating the logging configuration to let the changes take affect. """ logging_config.dictConfig(get_logging_configuration_dict())
Example #7
Source File: utils.py From MDT with GNU Lesser General Public License v3.0 | 5 votes |
def setup_logging(disable_existing_loggers=None): """Setup global logging. This uses the loaded config settings to set up the logging. Args: disable_existing_loggers (boolean): If we would like to disable the existing loggers when creating this one. None means use the default from the config, True and False overwrite the config. """ conf = get_logging_configuration_dict() if disable_existing_loggers is not None: conf['disable_existing_loggers'] = True logging_config.dictConfig(conf)
Example #8
Source File: acvtool.py From acvtool with Apache License 2.0 | 5 votes |
def setup_logging(): with open(config.logging_yaml) as f: logging_config.dictConfig(yaml.safe_load(f.read()))
Example #9
Source File: log.py From luscan-devel with GNU General Public License v2.0 | 5 votes |
def emit(self, record): pass # Make sure that dictConfig is available # This was added in Python 2.7/3.2
Example #10
Source File: client.py From pywxclient with Apache License 2.0 | 5 votes |
def run(): """Start wechat client.""" config.dictConfig(LOGGING) client_log = getLogger('client') session = Session() client = SyncClient(session) sync_session(client) client_log.info('process down...')
Example #11
Source File: thread_client.py From pywxclient with Apache License 2.0 | 5 votes |
def run(**kwargs): """Start wechat client.""" input_queue = queue.Queue() msg_queue = queue.Queue() login_event = threading.Event() exit_event = threading.Event() config.dictConfig(LOGGING) client_log = getLogger('client') session = Session() client = SyncClient(session) session_thread = threading.Thread( target=sync_session, args=(client, input_queue, login_event, exit_event)) reply_thread = threading.Thread( target=reply_message, args=(client, msg_queue, login_event, exit_event)) session_thread.start() reply_thread.start() show_input_message(client, input_queue, msg_queue, exit_event) session_thread.join() reply_thread.join() client_log.info('process down...')
Example #12
Source File: simpleSystemBase.py From Thespian with MIT License | 5 votes |
def __init__(self, system, logDefs = None): super(ActorSystemBase, self).__init__() self.system = system self._pendingSends = [] if logDefs is not False: dictConfig(logDefs or defaultLoggingConfig) self._primaryActors = [] self._primaryCount = 0 self._globalNames = {} self.procLimit = 0 self._sources = {} # key = sourcehash, value = encrypted zipfile data self._sourceAuthority = None # ActorAddress of Source Authority self._sourceNotifications = [] # list of actor addresses to notify of loads asys = self._newRefAndActor(system, system.systemAddress, system.systemAddress, External) extreq = self._newRefAndActor(system, system.systemAddress, ActorAddress('System:ExternalRequester'), External) badActor = self._newRefAndActor(system, system.systemAddress, ActorAddress('System:BadActor'), BadActor) self.actorRegistry = { # key=ActorAddress string, value=ActorRef system.systemAddress.actorAddressString: asys, 'System:ExternalRequester': extreq, 'System:BadActor': badActor, } self._internalAddresses = list(self.actorRegistry.keys()) self._private_lock = threading.RLock() self._private_count = 0 system.capabilities['Python Version'] = tuple(sys.version_info) system.capabilities['Thespian Generation'] = ThespianGeneration system.capabilities['Thespian Version'] = str(int(time.time()*1000)) system.capabilities['Thespian ActorSystem Name'] = 'simpleSystem' system.capabilities['Thespian ActorSystem Version'] = 2 system.capabilities['Thespian Watch Supported'] = False system.capabilities['AllowRemoteActorSources'] = 'No'