Open vikramsubramanian opened 3 months ago
rotation
parameter in the logger.add()
call is set correctly. It should be set to "00:00"
to rotate the file at midnight.compression
parameter in the logger.add()
call is set to a valid compression function or method if compression is desired after rotation.format
parameter in the logger.add()
call to ensure that the timestamp in the log messages is formatted correctly._terminate_file
method in the _file_sink.py
file to confirm that the file renaming logic is correct and that it generates the new file path with the correct date.generate_rename_path
function in the _file_sink.py
file to ensure that it generates the correct renamed path for the rotated file.FileDateFormatter
class is formatting the date correctly in the file name.datetime
objects used in the rotation logic are timezone-aware if the application requires timezones to be considered. Use datetime.datetime.now(datetime.timezone.utc)
for UTC time.
I have a Django rest service that runs continuously configured somewhere in the middleware. I'm facing two challenges:
Icrat-service_2024-01-23.2024-01-24_21-42-12_825363
2.The logs are written in the file with the wrong date in the shared screen shot the date modified you can see the logs were written in the log file of 29-02 instead of a new log file that should be created. ![image](
Here is the code.
)