Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These three patches which make it easier to use
systemd
/journald
's structured logging. When everything is in place, one can, for example, watch the log stream via this user-friendly :) command:That command will follow journal stream from the
my-app.service
. The logger whose name isonly-important-messages-are-shown-now
is rather heavily filtered, but everything from a logger calledI-want-details-from-this
is shown. These options are documented injournalctl
's manpage. Sadly, there is neither range-checking nor negative matching in there.I'm doing this mostly for use cases described in #1290 ...
journald: wider range of log severitiesThe previous code made it impossible to distinguish between thedebug
andtrace
severities. So instead of trying hard to preserve the equivalence ofspdlog::level::debug
withLOG_DEBUG
, which is -- in the end -- just an arbitrary name, make sure that functionality is not lost.Removed per explicit request; here's how to implement this:
journald: structured output for logger's name
Previously, the logger name was effectively lost. There were two choices on how to add it:
Via a formatter, which would mean that
journalctl
would not be able to filter against that. That would be suboptimal.As a "syslog identifier". This means that
journalctl
will, by default, stop showing the daemon's executable name and replace that via the logger name. The PID is still shown, and if one would like to go back to the previous behavior, it is still possible viajournalctl -o with-unit
.I think that the second option is strictly better than the first one.
fixes #1289
journald: fix source file location
This is what my manpage says, and what the original blog post says as well.