The logger is still not multiprocess capable! This needs to be fixed.
I added comments with more information.
This commit is contained in:
parent
a2fcec6054
commit
48a3e5e88f
3 changed files with 8 additions and 2 deletions
|
|
@ -33,7 +33,7 @@ from linspector.core.monitors import Monitors
|
|||
|
||||
# i currently only increase the 3rd number because the goal is that 0.19.* will become the first
|
||||
# stable version.
|
||||
__version__ = '0.19.56.dev1'
|
||||
__version__ = '0.19.57.dev1'
|
||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ log_level= debug
|
|||
log_file = ~/code/linspector/linspector/log/linspector.log
|
||||
; number of log files to be kept. i recommend to use the lowest sensible value for keeping performance high. so set
|
||||
; the size of the log file higher to increase the log history.
|
||||
log_file_count = 10
|
||||
log_file_count = 20
|
||||
; log file size in megabytes as int. the default is 10000000 bytes (10MiB) set in the code if not configured here.
|
||||
log_file_size = 1
|
||||
; log file size in bytes as int. you can set to bytes if you want to set a value lower then 1 megabyte. but it will
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ from logging import handlers
|
|||
logger = getLogger('linspector')
|
||||
|
||||
|
||||
# wow, this is not process capable! i thought in a last commit that the problem ist fixed, but it
|
||||
# isn't!!! see here for more details:
|
||||
# https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes
|
||||
# a different approach on handling this can be to use a exclusive log file for each process but
|
||||
# this is not what i want.
|
||||
# maybe subclass it from logging.Logger...?
|
||||
class Log:
|
||||
def __init__(self, configuration, stdout, verbose):
|
||||
|
|
@ -102,6 +107,7 @@ class Log:
|
|||
import inspect
|
||||
import multiprocessing
|
||||
import threading
|
||||
# https://www.geeksforgeeks.org/how-to-get-the-process-id-from-python-multiprocess/
|
||||
current_process = multiprocessing.current_process()
|
||||
from_stack = inspect.stack()[1]
|
||||
function_name = from_stack.function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue