Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log formatting #44

Closed
jesperpedersen opened this issue Feb 4, 2020 · 0 comments
Closed

Log formatting #44

jesperpedersen opened this issue Feb 4, 2020 · 0 comments
Labels
community Issue that can be picked up by the community enhancement Improvement to an existing feature

Comments

@jesperpedersen
Copy link
Collaborator

Implement log formatting codes that can style the logging output. Could borrow similar codes as PostgreSQL.

May require changes to zf_log.

@jesperpedersen jesperpedersen added enhancement Improvement to an existing feature community Issue that can be picked up by the community labels Feb 4, 2020
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 24, 2022
This introduces the configuration parameter `log_line_prefix`
that accepts a strftime(3) valid string that is parsed
and stored at the very first log entry in the configuration
structure (`config->log_line_prefix`).
Logging to a file and to the console is done using such
prefix via strftime.

Documentation updated.

Close agroal#44
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 25, 2022
This introduces the configuration parameter `log_line_prefix`
that accepts a strftime(3) valid string that is parsed
and stored at the very first log entry in the configuration
structure (`config->log_line_prefix`).
Logging to a file and to the console is done using such
prefix via strftime.

Documentation updated.

Close agroal#44
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 28, 2022
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
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 28, 2022
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
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 28, 2022
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
fluca1978 added a commit to fluca1978/pgagroal that referenced this issue Feb 28, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issue that can be picked up by the community enhancement Improvement to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant