-
Notifications
You must be signed in to change notification settings - Fork 1
logger
Dan Mushkevych edited this page Nov 12, 2015
·
3 revisions
A logger is automatically initialized for every process. By default it is rotation file log with max file size of 2MB and max number of files 10:
-
Import ProcessContext:
from system.process_context import ProcessContext
-
Get ready-to-use instance of the logger:
self.logger = ProcessContext.get_logger(your_application_name)
-
Review settings.py for the location of the log:
log_directory='/tmp/log/launchpy/'
-
By default log filename will be
token.log
To set custom name, specify it during process registration phase:
'your_worker_name': _create_context_entry(
process_name='your_worker_name', # name of the application
classname='workers.your_worker_module.your_worker_class_name', # fully specified class name
token='one-word-name-of-your-app'), # log tag, and .log and .pid files names
log_file='my_log_file_name.log') # custom log file name
- Should you feel too much logging magic - feel free to use
system.system_logger.Logger
directly