-
Notifications
You must be signed in to change notification settings - Fork 9
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
Print nice journal messages #303
Conversation
b60304d
to
72a88fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little bit uneasy with a special formatting if the output is not a TTY:
Maybe it’s not the journal, and you want just to redirect to a file, so you run the executable, you end up with the logs in one way, you rerun and redirect to a file, and the formatting is different! I think if we want different formatting, then only have this journal format when under systemd to the journal (even if in general, contrary to previous syslog, you shouldn’t really worry about the output formatting, but I agree the time stuttering is something to fix.
Also, we should have tests for all of those (formatting writing, ensuring there is no date for the journal) and detection.
72a88fd
to
2b3f32f
Compare
Valid point. Taking a step back, maybe we don't need to support anything else than logging to the journal (for now)? At least I've never had a use case to run the broker (or authd) directly instead of via the systemd service - and even if I did, I don't think I would mind reading the logs via the journal. What do you think? |
If at some point we have a use case to print the logs to stdout/stderr, we could add a |
They used to look like this Jan 07 14:27:26 ubuntu authd-msentraid.authd-msentraid[44768]: time=2025-01-07T14:27:26.272+01:00 level=INFO msg="Serving requests as com.ubuntu.authd.MSEntraID" now they look like this Jan 09 17:48:31 ubuntu authd-msentraid[8991]: Serving requests as com.ubuntu.authd.MSEntraID and also use the corresponding journal priorities so that those can be filtered and are displayed as expected (i.e. with color and boldness).
2b3f32f
to
a92aee9
Compare
As discussed, I'm now using
I tried but didn't manage to get |
Ok, so the decision factor may be overkill to test with those constraints. However, I would still like to see test for the formatter itself, which could be easily tested and not relying on the journal for those. |
True, we could test the formatter itself. However, if we want to use authd's |
We decided out-of-band to try using the |
Superseded by #315 |
They used to look like this
now they look like this
and also use the corresponding journal priorities so that those can be filtered and are displayed as expected (i.e. with color and boldness).
UDENG-4523