forked from agroal/pgagroal
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
See initial work in agroal#213. This patch implements the log rotation and formatting support. There are now three new configuration options: - log_line_prefix is a strftime(3) compatible string that is used as a prefix whenever a new line is logged to console or file; - log_rotation_age provides the age (in seconds) of when the log must be rotated. There is raw support for human strings like '1d' for 'one day'; - log_rotation_size provides the size in bytes when the log must be rotated. Log rotation is evaluated at every new log line issuing, that means the age and the size are not honored effectively until a new log line is issued. When the system decides to rotate the log, the log file is flushed and a new one is opened. To allow rotation, log_path supports a strftime(3) compatible string like log_path = /var/log/pgagroal/pgagroal-%Y-%m-%d-%H-%M-%S.log so that whnever a new log file must to be created, it can be placed side by side the closed one. In the case the new log file already exists, the log_mode is used to decide if the log must be truncated or used in append mode. In the case the log_mode is set to console or to syslog, the log rotation is automatically disabled, therefore the overhead of the rotation machinery will be applied only when logging to a file. Example of configuration: log_type = file log_level = info log_path = /var/log/pgagroal/pgagroal-%Y-%m-%d-%H-%M-%S.log log_mode = create log_rotation_size = 2M log_rotation_age = 1m log_line_prefix = PGAGROAL-%Y-%m-%d-%H:%M:%S' Close agroal#44 Close agroal#45
- Loading branch information
Showing
4 changed files
with
460 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.