journalctl 不显示 snap 日志

journalctl 不显示 snap 日志

当我在终端中运行 snap 应用程序时,如下所示:

/usr/bin/snap run shadowsocks-rust.ssserver -c /etc/shadowsocks-rust/config.json

我看到了日志:

2023-05-14T18:55:11.714373725+03:00 INFO  shadowsocks server 1.15.3 build 2023-03-12T16:38:32.068195882+00:00
2023-05-14T18:55:11.715955767+03:00 INFO  shadowsocks tcp server listening on 0.0.0.0:12345, inbound address 0.0.0.0:12345

但是当我以 systemd 服务形式运行相同的程序时:

[Unit]
Description=shadowsocks service
After=network-online.target

[Service]
User=myuser
ExecStart=/usr/bin/snap run shadowsocks-rust.ssserver -c /etc/shadowsocks-rust/config.json
Restart=always

[Install]
WantedBy=multi-user.target

我看到的唯一日志来自 systemd( journalctl -u shadowsocks.service):

May 14 18:37:08 mypc systemd[1]: Started shadowsocks service.

服务状态:

# systemctl status shadowsocks.service
● shadowsocks.service - shadowsocks service
     Loaded: loaded (/etc/systemd/system/shadowsocks.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-05-14 18:37:08 MSK; 6s ago
   Main PID: 3453512 (ssserver)
      Tasks: 0 (limit: 9135)
     Memory: 32.0K
        CPU: 87ms
     CGroup: /system.slice/system-shadowsocks.slice/shadowsocks.service
             ‣ 3453512 /snap/shadowsocks-rust/443/bin/ssserver -c /etc/shadowsocks-rust/config.json

如何让 journalctl 显示作为 systemd 服务运行的 snap 的日志?

相关内容