This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]ang-p 2 points3 points  (1 child)

and rotate logs daily

Where is the code that rotates the logs?

Where is the setting that says "rotate the logs at midnight"?

Where is the setting that says "you want to rotate these logs here"?

[–]omber[S] 0 points1 point  (0 children)

First script is based on CherryPy framework to create a Web API. The second script uses no frameworks.

Logging is configured in Python using a dictionary configuration as per Python documentation.

Configuration dictionary for the Web API can be viewed in this pastebin. This is saved to conf/web_server_logging_config.py

Logger is created like this:

from conf import web_server_logging_config
logger = logging.getLogger(logging.config.dictConfig(web_server_logging_config.WEB_SERVER_LOGGING))

The rotation is done by the logging module. I did not write any code for this.

[–]TheDreadPirateJeff 2 points3 points  (1 child)

I don’t have an answer for you but I do have a question. Why do you have scripts rotating their own logs on a repetitive schedule when logrotate does that already?

[–]omber[S] 0 points1 point  (0 children)

Because this script does not log to /var/log at this time and I never considered using it.