【发布时间】:2017-10-05 23:50:51
【问题描述】:
Journalctl 似乎跳过了相应服务正在输出的进程的一些输出。这是怎么回事?
这是一个小例子:我有一个名为tester.py的脚本
import time
count = 0
while True:
time.sleep(.001)
count += 1
print count
我有以下名为tester.service的服务
[Unit]
Description=lots of output
After=network.target
[Service]
User=django
Group=django
WorkingDirectory=/home/django
ExecStart=/usr/bin/python -u tester.py
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
在运行sudo systemctl start tester 并等待几秒钟后,我再运行sudo journalctl -u tester。
我注意到输出跳过了大块的数字。例如,下面是一段摘录:
Oct 05 23:44:00 staging python[23185]: 999
Oct 05 23:44:00 staging python[23185]: 1000
Oct 05 23:44:00 staging python[23185]: 1001
Oct 05 23:44:29 staging python[23185]: 26829
Oct 05 23:44:29 staging python[23185]: 26830
Oct 05 23:44:29 staging python[23185]: 26831
Oct 05 23:44:29 staging python[23185]: 26832
Oct 05 23:44:29 staging python[23185]: 26833
【问题讨论】:
-
包括你正在使用的
systemd的版本。 -
如果您查看完整的
journalctl输出,是否也存在差距? -
天哪,这是限速的!不带任何参数的 journalctl 显示
Suppressed xxx messages from /system.slice/tester.service.. 默认为每 30 秒 1000 条消息。谢谢@MarkStosberg
标签: python ubuntu unix logging systemd