-
Notifications
You must be signed in to change notification settings - Fork 12
Description
- PySeq version:
- Python version: Python 3.10.6
- Operating System: Ubuntu 22.04.1 LTS
Description
In my python FastAPI app i created loging config file that looks like this (now there are multiple instances of seq handler cause I was testing it out)
import logging
from logging.handlers import TimedRotatingFileHandler
from seqlog import structured_logging
import seqlog
logPath: str = './logs/log.log'
logging.basicConfig(
handlers=[
TimedRotatingFileHandler(logPath, when='midnight', interval=1, backupCount=30, encoding='utf-8')
, structured_logging.SeqLogHandler(server_url='http://localhost:5341')
, seqlog.SeqLogHandler(server_url='http://localhost:5341')
, structured_logging.ConsoleStructuredLogHandler()
#, logging.StreamHandler()
],
level = logging.INFO,
format = '%(asctime)s - %(name)s(%(lineno)d) - %(levelname)s - %(message)s',
datefmt = '%d.%m.%Y %H:%M:%S'
)
logger = logging.getLogger(__name__)
logger.info('This is test')
At the start of my main.py this module is included to config logging
from modules.logging import loggingModel
Each module in my app has it's own logger
Message from end of loggingModel.py file is sent to seq altough without format that is set in basic config, just plain message
But all other log messages through app are not sent to seq
TimeRotatingFileHandler and even seqlog ConsoleStructuredHandler are working through entire app and log messages as expected
ConsoleStructuredHandler
TimeRotatingFileHandler
I'm not sure what am I doing wrong and how to fixit
What I Did
I tried to remove formatting, remove all other handlers expect seqlog, create handler with multiple different options, adding keys, json_encoders, nothing worked