Systemd:似乎无法让 sidekiq 登录到文件

Systemd: can't seem to get sidekiq to log to a file

我正在尝试做一些非常简单的事情:在启动时使用 systemd 启动 sidekiq。但是我在日志记录方面遇到了问题 - 它只是不会记录到我想要的文件,由于某种原因,它的所有日志记录都会转到 /var/log/messages。

我的.service文件如下:

# /etc/systemd/system/sidekiq.service
[Unit]
Description=sidekiq
After=network.target

[Service]
Type=simple
WorkingDirectory=/app/site
ExecStart=/bin/bash -lc 'bundle exec sidekiq -e production -C config/sidekiq.yml'
User=root
Group=root

# if we crash, restart
RestartSec=1
#Restart=on-failure
Restart=always

StandardOutput=append:/app/site/log/sidekiq.out.log
StandardError=append:/app/site/log/sidekiq.err.log

[Install]
WantedBy=httpd.target

我知道有很多答案都非常详细地解释了如何让 sidekiq 与 systemd 一起工作以及如何设置日志记录到服务文件,我在过去的几个小时里看到了所有这些答案,显然仍然遗漏了一些东西.

selinux 已关闭,目录可写,日志文件为 777,守护程序已重新加载,sidekiq 为 运行,没有其他错误出现在任何地方

我是不是做错了什么导致我无法完成这个非常简单的任务?

您可能 运行 旧版本的 systemd 不支持这种日志配置方式。你需要 v236+.