Skip to content

Instantly share code, notes, and snippets.

@suganoo
Last active September 5, 2017 07:05
Show Gist options
  • Save suganoo/ad8e1a0a67351bfac7949f1b688b8c70 to your computer and use it in GitHub Desktop.
Save suganoo/ad8e1a0a67351bfac7949f1b688b8c70 to your computer and use it in GitHub Desktop.
logging propertyのフォーマット
[loggers]
keys=root,hogehogetool
[handlers]
keys=defaultHandler,hogehogetoolHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=INFO
handlers=defaultHandler
[logger_hogehogetool]
#!!! describe same level for logger and hander
level=INFO
handlers=hogehogetoolHandler
propagate=0
qualname=hogehogetool
[handler_defaultHandler]
class=StreamHandler
level=INFO
formatter=simpleFormatter
args=(sys.stdout,)
[handler_hogehogetoolHandler]
class=FileHandler
#!!! describe same level for logger and hander
level=INFO
formatter=simpleFormatter
args=("/var/log/hogehogetool/hogehogetool.log","a")
[formatter_simpleFormatter]
format=%(asctime)s [%(levelname)s] pid:%(process)d %(module)s.%(funcName)s : %(message)s
datefmt=%Y-%m-%d %H:%M:%S
import logging
import logging.config
logging.config.fileConfig(”(logging property path)”)
self.logger = logging.getLogger("hogehogetool")
@suganoo
Copy link
Author

suganoo commented Sep 1, 2017

import logging
import logging.config
logging.config.fileConfig(”(logging property path)”)
self.logger = logging.getLogger("hogehogetool")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment