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.file.rotation.date syntax supports a limited number of options compared to Lager #3831

Closed
sedhupathygit opened this issue Dec 2, 2021 · 6 comments
Assignees
Labels
Milestone

Comments

@sedhupathygit
Copy link

in config file the line log.file.rotation.date = $D0 is working fine whereas the $D12H30 or anything other than day is causing a failure to start service. I'm using rabbitmq-server=3.9.11-1 and erlang/bionic 1:24.1.7-1 and primary configuration file format.

The error log :

Application rabbit exited with reason: {{cannot_log_to_file,unknown,{callback_crashed,{error,{case_clause,{0,[]}},[{rabbit_logger_std
,application_controller,"{application_start_failure,rabbit,{{cannot_log_to_file,unknown,{callback_crashed,{error,{case_clause,{0,[]}},[{rabbit_logger_std_h,pa
pplication_controller) ({application_start_failure,rabbit,{{cannot_log_to_file,unknown,{callback_crashed,{error,{case_clause,{0,[]}},[{rabbit_logger_std_h,par 
@rabbitmq rabbitmq deleted a comment from sedhupathygit Dec 2, 2021
@michaelklishin michaelklishin transferred this issue from rabbitmq/rabbitmq-website Dec 2, 2021
@michaelklishin michaelklishin changed the title log.file.rotation.date is not working for debian log.file.rotation.date fails with an exception when set to $D12H30 Dec 2, 2021
@michaelklishin michaelklishin changed the title log.file.rotation.date fails with an exception when set to $D12H30 log.file.rotation.date fails with an exception with certain values Dec 2, 2021
@michaelklishin
Copy link
Member

parse_date_spec/1 misses clauses for $H:

parse_date_spec(false) ->
    false;
parse_date_spec("") ->
    false;
parse_date_spec([$$,$D | DateSpec]) ->
    io:format(standard_error, "parse_date_spec: ~p (hour)~n", [DateSpec]),
    parse_hour(DateSpec, #{every=>day,
                           hour=>0});
parse_date_spec([$$,$W | DateSpec]) ->
    io:format(standard_error, "parse_date_spec: ~p (week)~n", [DateSpec]),
    parse_day_of_week(DateSpec, #{every=>week,
                                  hour=>0});
parse_date_spec([$$,$M | DateSpec]) ->
    io:format(standard_error, "parse_date_spec: ~p (month)~n", [DateSpec]),
    parse_day_of_month(DateSpec, #{every=>month,
                                   hour=>0});
parse_date_spec(DateSpec) ->
    io:format(standard_error, "parse_date_spec: ~p (error)~n", [DateSpec]),
    error.

@dumbbell is there a reason for that?

The function logs to standard error, which for this setting doesn't seem to be necessary.

@michaelklishin
Copy link
Member

The following examples from the doc fail with various function clauses. It's not specific to Debian:

log.file.rotation.date = $W5D16
log.file.rotation.date = $H00

@michaelklishin
Copy link
Member

From the looks of some portions of the parser and docs, my guess is that the format documentation predates the standard OTP logger transition. All those values were supported by Lager but the current implementation is a lot more limited.

@michaelklishin
Copy link
Member

michaelklishin commented Dec 2, 2021

https://rabbitmq.com/logging.html#log-rotation no longer documents what we do not support. On Linux, logrotate should be an easily accessible option which would always be superior to anything that built-in rotation ever provides. So use that.

@michaelklishin michaelklishin changed the title log.file.rotation.date fails with an exception with certain values log.file.rotation.date syntax supports a limited number of options compared to Lager Dec 2, 2021
@lukebakken lukebakken self-assigned this Dec 2, 2021
@lukebakken
Copy link
Collaborator

michaelklishin added a commit that referenced this issue Dec 2, 2021
to successfully parse all cases presented in Lager docs.

References #3831
@michaelklishin michaelklishin added this to the 3.9.12 milestone Dec 2, 2021
mergify bot pushed a commit that referenced this issue Dec 3, 2021
to successfully parse all cases presented in Lager docs.

References #3831

(cherry picked from commit c5033b0)
@lukebakken
Copy link
Collaborator

Fixed by #3835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants