Rework log rotation #2498

Closed
opened 2025-11-02 04:38:36 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @micw on GitHub (Nov 6, 2018).

Currently, log rotation in gitea is done implicitly in the file logger when log files exceeds a given age or size. This can cause race condition on "serv" commands where multiple processes write to the same logfile.
Example:
2 serv commands are started, read the logfile size which is close to maximum size and write a log line. Now both processes will rotate the logs.

We should either
a) rework log rotation so that is handled by the long-running server process
b) remove log rotation entirely from gitea and use "logrotate" on the docker images.
or
c) remove file logging entirely from gitea and use the sysem's logging infrastructure (syslog, systemd-journal or such)

Originally created by @micw on GitHub (Nov 6, 2018). Currently, log rotation in gitea is done implicitly in the file logger when log files exceeds a given age or size. This can cause race condition on "serv" commands where multiple processes write to the same logfile. Example: 2 serv commands are started, read the logfile size which is close to maximum size and write a log line. Now both processes will rotate the logs. We should either a) rework log rotation so that is handled by the long-running server process b) remove log rotation entirely from gitea and use "logrotate" on the docker images. or c) remove file logging entirely from gitea and use the sysem's logging infrastructure (syslog, systemd-journal or such)
GiteaMirror added the type/proposal label 2025-11-02 04:38:36 -06:00
Author
Owner

@lunny commented on GitHub (Nov 7, 2018):

I think we could use another matured log library to maintain a this one.

@lunny commented on GitHub (Nov 7, 2018): I think we could use another matured log library to maintain a this one.
Author
Owner

@zeripath commented on GitHub (Jun 6, 2020):

I'm going to close this as we no longer write to the serv.log.

@zeripath commented on GitHub (Jun 6, 2020): I'm going to close this as we no longer write to the serv.log.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2498