Skip to main content

A simple log moduel based logging for python.

Project description

# log4p
Simple log module for python.

Config file:
<module dir>/log4p.json
Default config is:
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"simple": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
"detail": {
"format": "%(asctime)-15s %(levelname)-5s %(filename)s +%(lineno)d %(funcName)s [%(threadName)s]: %(message)s"

"handlers": {
"console": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "simple",
"stream": "ext://sys.stdout"

"debug_file_handler": {
"class": "logging.handlers.TimedRotatingFileHandler",
"level": "DEBUG",
"formatter": "detail",
"filename": "/tmp/debug.log",
"when": "H",
"interval": 1,
"backupCount": 5,
"encoding": "utf8"

"error_file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"level": "ERROR",
"formatter": "detail",
"filename": "/tmp/errors.log",
"maxBytes": 10485760,
"backupCount": 2,
"encoding": "utf8"

"loggers": {
"my_module": {
"level": "ERROR",
"handlers": ["console"],
"propagate": "no"

"root": {
"level": "INFO",
"handlers": ["console", "debug_file_handler", "error_file_handler"]

pip install log4p
Add to you script:
import log4p
SCRIPT_NAME = os.path.basename(__file__)
pLogger = log4p.GetLogger(SCRIPT_NAME, logging.DEBUG).get_l()
pLogger.debug("Type some log.")

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
log4p-2017.12.14.4-py3-none-any.whl (4.9 kB) Copy SHA256 hash SHA256 Wheel py3

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page