log for python like log4j2
Project description
# log4p
log for python like java log4j2
use config file [log4p.py], in the application root directory.
2018.08.16 add syslog, flume support
----------------------------------
App Example:
from log4p import log
TestLog = log(__name__)
TestLog.debug("Debug Log")
TestLog.info("Info Log")
out put like this:
2015-01-20 16:18:47,692 DEBUG [Thread-3] data.LogInsert (LogInsert.py:172) - Debug Log
2015-01-20 16:18:47,692 DEBUG [Thread-3] data.LogInsert (LogInsert.py:173) - Info Log
----------------------------------
Config Example:
config ={
'monitorInterval' : 10,
'loggers' :{
'LogThread' :{
'level': "DEBUG",
'additivity' : False,
'AppenderRef' : ['A1']
},
'root' :{
#'level' : "CRITICAL",
'level' : "ERROR",
'AppenderRef' : ['output_root']
}
},
'appenders' :{
'output_root' :{
'type' :"file",
'FileName' :"root_error.log",
'backup_count': 5,
'file_size_limit': 1024 * 1024 * 20
'PatternLayout' :"[level:%(levelname)s-file:%(filename)s-lineno:%(lineno)d] %(asctime)s %(message)s"
},
'A1' :{
'type' :"file",
'FileName' :"A2.log",
'PatternLayout' :"[level:%(levelname)s-file:%(filename)s-lineno:%(lineno)d] %(asctime)s %(message)s"
},
'flumeTest' :{
'type': "FLUME",
'host': "192.168.10.120",
'port': 44444,
'headers': {'application': 'Skyline.Analyzer'},
'PatternLayout': "[PID:%(process)d-level:%(levelname)s-file:%(filename)s-lineno:%(lineno)d] %(asctime)s %(message)s"
},
'console' :{
'type' :"console",
'target' :"console",
'PatternLayout' :"[%(levelname)s] %(asctime)s %(message)s"
}
}
}
log for python like java log4j2
use config file [log4p.py], in the application root directory.
2018.08.16 add syslog, flume support
----------------------------------
App Example:
from log4p import log
TestLog = log(__name__)
TestLog.debug("Debug Log")
TestLog.info("Info Log")
out put like this:
2015-01-20 16:18:47,692 DEBUG [Thread-3] data.LogInsert (LogInsert.py:172) - Debug Log
2015-01-20 16:18:47,692 DEBUG [Thread-3] data.LogInsert (LogInsert.py:173) - Info Log
----------------------------------
Config Example:
config ={
'monitorInterval' : 10,
'loggers' :{
'LogThread' :{
'level': "DEBUG",
'additivity' : False,
'AppenderRef' : ['A1']
},
'root' :{
#'level' : "CRITICAL",
'level' : "ERROR",
'AppenderRef' : ['output_root']
}
},
'appenders' :{
'output_root' :{
'type' :"file",
'FileName' :"root_error.log",
'backup_count': 5,
'file_size_limit': 1024 * 1024 * 20
'PatternLayout' :"[level:%(levelname)s-file:%(filename)s-lineno:%(lineno)d] %(asctime)s %(message)s"
},
'A1' :{
'type' :"file",
'FileName' :"A2.log",
'PatternLayout' :"[level:%(levelname)s-file:%(filename)s-lineno:%(lineno)d] %(asctime)s %(message)s"
},
'flumeTest' :{
'type': "FLUME",
'host': "192.168.10.120",
'port': 44444,
'headers': {'application': 'Skyline.Analyzer'},
'PatternLayout': "[PID:%(process)d-level:%(levelname)s-file:%(filename)s-lineno:%(lineno)d] %(asctime)s %(message)s"
},
'console' :{
'type' :"console",
'target' :"console",
'PatternLayout' :"[%(levelname)s] %(asctime)s %(message)s"
}
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
log4python-0.2.25.tar.gz
(8.2 kB
view details)
File details
Details for the file log4python-0.2.25.tar.gz.
File metadata
- Download URL: log4python-0.2.25.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.11.1 setuptools/16.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/2.7.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e460106c220c53932a6b8e12f140c9ea2b377146de5d3a51d3aaafd0ba14d84a
|
|
| MD5 |
a305fa9eeecde535fcaf0e1da3397032
|
|
| BLAKE2b-256 |
4b3273a0f1d2cabe1b64c64c8454146f2528e01f3646a39f4ccdc58474b65433
|