<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEEDINFO "
title="NEEDINFO --- - if unit's process exits non-zero no more logging for that unit until reboot"
href="https://bugs.freedesktop.org/show_bug.cgi?id=81019#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_NEEDINFO "
title="NEEDINFO --- - if unit's process exits non-zero no more logging for that unit until reboot"
href="https://bugs.freedesktop.org/show_bug.cgi?id=81019">bug 81019</a>
from <span class="vcard"><a class="email" href="mailto:p.staszewski@gmail.com" title="Piotr Staszewski <p.staszewski@gmail.com>"> <span class="fn">Piotr Staszewski</span></a>
</span></b>
<pre>I did some more testing today, and my results are weird, but I suspect it's due
to my peculiar setup.
I have /var/log as a tmpfs ('tmpfs /var/log tmpfs
defaults,noatime,nodiratime,mode=0755,size=16M 0 0').
0. Testing software
Simple printf() loop, binary at /home/user/test-logging:
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int counter = 0;
while (1) {
printf("<5>Counter: %d\n", counter);
fflush(stdout);
sleep(3);
counter++;
}
}
Service file, saved at /etc/systemd/system/test-logging.service:
[Unit]
Description=Logging tester
After=network.target
[Service]
ExecStart=/home/user/test-logging
WorkingDirectory=/home/user
Restart=always
[Install]
WantedBy=multi-user.target
1. Test one
Systemd and journald have been running since boot, where journald.conf has:
[Journal]
Storage=persistent
SyncIntervalSec=30m
SystemMaxUse=8M
At shell:
systemctl start test-logging
systemctl status test-logging - did it a couple of times, no counter output
logged whatsoever
systemctl stop test-logging
2. Test two
Modified journald.conf to have only:
[Journal]
SystemMaxUse=8M
At shell:
systemctl restart systemd-journald
systemctl start test-logging
systemctl status test-logging - did it a couple of times, counter output is
being logged as intended
systemctl restart test-logging
systemctl status test-logging - still logging as it should
systemctl stop test-logging
3. Test three
So I added back my two custom options to journald.conf:
[Journal]
Storage=persistent
SyncIntervalSec=30m
SystemMaxUse=8M
At shell:
systemctl restart systemd-journald
systemctl start test-logging
systemctl status test-logging - did it a couple of times, logging well as in
the previous test!
systemctl stop test-logging
In a way my problem seems to be solved, though I do not understand exactly why
the logging works as the above tests show. My guess is that the tmpfs /var/log
with Storage=persistent causes some trouble on boot and systemd is not logging;
then restarting it without the Storage options invokes some setup code, so that
from that point the logging works regardless of Storage or SyncIntervalSec
values...
Please feel free to close this issue if the above behaviour is a known
condition/intended feature etc.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>