Answer the question
In order to leave comments, you need to log in
How to correctly log data through loguru in django with docker?
Hello, I have a question about logging data inside a container.
In django I use the loguru library to implement this functionality with the following settings
logger.add(f'{BASE_DIR}/logs/today.log',
rotation='00:00',
compression='tar.gz',
format='{time:YYYY-MM-DD HH:mm} | {level} | {message} | {file.path}:{function}')
Answer the question
In order to leave comments, you need to log in
This is probably not the most correct approach in terms of Best Practices.
Docker advises container logs to be sent to STDOUT and STDERR. Then through docker logs you can see them all. In addition, using the mechanisms of the docker itself or then send kubernetes to any centralized storage
https://docs.docker.com/config/containers/logging/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question