I'm new to python and trying to setup a logger in my simple app.
This is the app structure:
- checker
- checking
- proxy_checker.py
- custom_threading
- __init__.py
- executor_my.py
- long_task.py
- tests
- __init__.py
- logging_config.ini
- main.py
i'm trying to setup the file configured logger
in the main module's checker/__init__.py:
from logging.config import fileConfig
fileConfig('logging_config.ini')
logging_config.ini
[loggers]
keys=root
[handlers]
keys=stream_handler
[formatters]
keys=formatter
[logger_root]
level=DEBUG
handlers=stream_handler
[handler_stream_handler]
class=StreamHandler
level=DEBUG
formatter=formatter
args=(sys.stderr,)
[formatter_formatter]
format=%(asctime)s %(name)-12s %(levelname)-8s %(message)s
and the use it in the /checker/custom_threading/exector_my.py:
import concurrent.futures
import logging
from custom_threading.long_task import LongTask
class MyExecutor(object):
logger = logging.getLogger(__name__)
_executor = concurrent.futures.ThreadPoolExecutor(max_workers=500)
def __init__(self, thread_count, task):
self._thread_count = thread_count
self._task = LongTask(task)
pass
def start(self):
self.logger.debug("Launching with thread count: " + str(self._thread_count))
*more irrelevant code*
tried to use logger.info / logger.debug. for both options i don't get any error and nothing is logged in console. What do i do wrong?
P.S. maybe also useful that i run it on Win 10 x64
MyExecutor.start()method called?main.py->executor = MyExecutor(thread_count, _proxy_checker.check_countries_in_proxylist) executor.start()