diff options
author | Ryan Hendrickson <ryan.hendrickson@alum.mit.edu> | 2021-04-30 12:47:10 -0400 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-05-03 17:48:41 +0200 |
commit | c2503e359a3a03b73acce0a92d27b1b8f54ff92c (patch) | |
tree | 1e79024029ae8745851ec108c91e3d2aa3daff55 /test | |
parent | 16ecdf3c80087613c3bb424b09185a7389d74553 (diff) | |
download | systemd-c2503e359a3a03b73acce0a92d27b1b8f54ff92c.tar.gz |
core: apply LogLevelMax to messages about units
This commit applies the filtering imposed by LogLevelMax on a unit's
processes to messages logged by PID1 about the unit as well.
The target use case for this feature is a service that runs on a timer
many times an hour, where the system administrator decides that writing
a generic success message to the journal every few minutes or seconds
adds no diagnostic value and isn't worth the clutter or disk I/O.
Diffstat (limited to 'test')
-rw-r--r-- | test/testsuite-04.units/silent-success.service | 6 | ||||
-rwxr-xr-x | test/units/testsuite-04.sh | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/testsuite-04.units/silent-success.service b/test/testsuite-04.units/silent-success.service new file mode 100644 index 0000000000..a9f713701c --- /dev/null +++ b/test/testsuite-04.units/silent-success.service @@ -0,0 +1,6 @@ +[Unit] +Description=Silent successful service + +[Service] +LogLevelMax=notice +ExecStart=/bin/true diff --git a/test/units/testsuite-04.sh b/test/units/testsuite-04.sh index da5f9ee2af..7a17e08611 100755 --- a/test/units/testsuite-04.sh +++ b/test/units/testsuite-04.sh @@ -98,6 +98,11 @@ cmp /expected /output [[ $(journalctl -b -o cat -t "$ID" --output-fields=_PID | sort -u | grep -c "^.*$") -eq 3 ]] [[ $(journalctl -b -o cat -t "$ID" --output-fields=MESSAGE | grep -Pc "^(This will|usually fail|and be truncated)$") -eq 3 ]] +# test that LogLevelMax can also suppress logging about services, not only by services +systemctl start silent-success +journalctl --sync +[[ -z `journalctl -b -q -u silent-success.service` ]] + # Add new tests before here, the journald restarts below # may make tests flappy. |