Conversation
|
Thank you for raising this topic! I think that vast majority of the |
|
It does make sense. New push coming shortly. |
| rc |= writeState(stateFile); | ||
|
|
||
| if (debug && rc) | ||
| message(MESS_ERROR, "logrotate has had %d errors", rc); |
There was a problem hiding this comment.
This output is misleading. rc is a return code, not count of errors.
|
This pull request becomes messy as there are a lot of commits reverting each other. The resulting diff just adds the debug/info/verbose/error/fatal/unknown prefix, as I understand it. Note that the debug prefix does not work well for example with |
|
@kdudka I apologize for the messy commit history, I’ve been working in Go mostly these days, and didn’t know how to best build and run test locally. I ended up having a couple of script locally. I hadn’t considered how it would pollute the output. I hadn’t been concerned with that since I’m used to writing syslog formatted messages so the log level being on each line feels normal but I understand the need to minimize behavior changes. Perhaps an additional flag for whether or not to pretend with That way each time a series of debug level logs comes through, it is only pretended once? |
|
Can't we just use the prefix for error messages only? Those affect logrotate's exit code after all... |
|
Not sure if this is related place to post, but it seems that First type will trigger RC 1, while second type will return RC 0. Perhaps it would be possible to either: Place output to stdout which does not trigger RC 0, and/or separate error messages in stderr to determine which ones does trigger RC 1. |
Currently all messages are printed to Lines 60 to 64 in 5b4518d but the message log does not need rotating (log size is below the 'size' threshold) is only printed in debug modeLines 1427 to 1430 in 5b4518d |
What
Improving error messaging.
grep"error".Why?
When certain pieces of code change the exit-code to 1 and don't say the word error in their output, it makes it challenging to determine why logrotate is failing its checks without diving into the code.
Example
From the output of
logrotate -d, it looks like there are no problems, it just exits 1. So you comb through the output looking for a message that indicates the reason, but nothing looks like a failure. You see a message likeThis is an error and is raising the exit code, but it is unclear that this is the behavior that is causing the failure
Related to #238