if have python app running in google app engine, how can dynamically change app's logging level during runtime? app's logging level done via logging config file.
one brute force way update logging config file locally, , run 'appcfg.py -r update path_to_product'. update modified files.
is there better way this?
i looked @ dictconfig , fileconfig. using these methods not update logging configuration of running processes (especially running on different app engine instances).
you can create handler method , call dynamically set log level @ runtime.
eg:
def loglevel(self, request): # ?value= notset, debug, info, warn, error, fatal, critical value = request.value.upper() if request.value else none logging.info("setting log level to: {}".format(value)) logging.getlogger().setlevel(value) logging.debug("test debug") logging.info("test info") logging.warn("test warn") logging.error("test error") logging.critical("test critical") specific loggers may targeted eg:
logging.getlogger('suds').setlevel(value) (note in gae launcher 'debug' logs not shown default.)
Comments
Post a Comment