【问题标题】:can not find logs of resque worker as a systemd service找不到 resque worker 的日志作为 systemd 服务
【发布时间】:2021-03-15 10:47:43
【问题描述】:

我自己在没有任何 Ruby 背景的情况下托管/支持 Ruby on Rails 应用程序。如果我没记错的话,该应用程序本身主要在德国使用。但我的问题实际上与应用程序无关,而是与使用的 resque 工作人员有关。

我将 resque worker 配置为 systemd 服务,如下所示:

[Unit]
Description=resque-worker for pageflow

[Service]
User=pageflow
WorkingDirectory=/home/pageflow/pageflow_daad
ExecStart=/usr/local/bin/bundle exec /usr/local/bin/rake resque:work > 
/home/pageflow/pageflow_daad/log/resquework.log &
#ExecStart=/home/pageflow/.rbenv/shims/rake resque:work &
Environment=QUEUE=*
Environment=RAILS_ENV=production

[Install]
WantedBy=multi-user.target

此工作人员可以毫无问题地处理图像/视频上传。现在我添加了一个新的应用程序功能,它可以抓取特定的页面。这个过程也由工人处理。在这种情况下,我最终会遇到在任何日志中都找不到的错误。具体来说,我根本找不到工人或调度员的任何日志。

我现在已经查看了这些位置:

  • Applicationroot/log/production.log
  • Applicationroot/log/jobs/production(应用开发者告知不再使用)
  • /var/log/nginx/error.log
  • journalctl -u resque-worker.service

这是systemctl status resque-worker.service的输出

esque-worker.service - resque-worker for pageflow
   Loaded: loaded (/etc/systemd/system/resque-worker.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-03-11 13:46:52 CET; 3 days ago
 Main PID: 30864 (bundle)
    Tasks: 5
   Memory: 186.0M
      CPU: 2min 10.308s
   CGroup: /system.slice/resque-worker.service
           └─30864 resque-1.27.4: Waiting for default,mailer,mailers,resizing,scraping,slow

Mar 11 13:46:52 ostheim-stg bundle[30864]: Gem::Specification#rubyforge_project= called from /home/pageflow/pageflow_daad/vendor/bundle/ruby/2.3.0/specifications/zencoder-2.5.1.gemspec:15.
Mar 11 13:46:52 ostheim-stg bundle[30864]: NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Mar 11 13:46:52 ostheim-stg bundle[30864]: Gem::Specification#rubyforge_project= called from /home/pageflow/pageflow_daad/vendor/bundle/ruby/2.3.0/specifications/vegas-0.1.11.gemspec:17.
Mar 11 13:46:52 ostheim-stg bundle[30864]: NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Mar 11 13:46:52 ostheim-stg bundle[30864]: Gem::Specification#rubyforge_project= called from /home/pageflow/pageflow_daad/vendor/bundle/ruby/2.3.0/specifications/rufus-scheduler-2.0.24.gemspec:16.
Mar 11 13:46:56 ostheim-stg bundle[30864]: DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Mar 11 13:46:56 ostheim-stg bundle[30864]: Please register a mime type using `register_mime_type` then
Mar 11 13:46:56 ostheim-stg bundle[30864]: use `register_compressor` or `register_transformer`.
Mar 11 13:46:56 ostheim-stg bundle[30864]: https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
Mar 11 13:46:56 ostheim-stg bundle[30864]:  (called from block in <class:Railtie> at /home/pageflow/pageflow_daad/vendor/bundle/ruby/2.3.0/gems/react-rails-1.8.0/lib/react/rails/railtie.rb:110)

谁能给我提示在哪里进一步寻找? A 还将应用程序日志级别更改为 :info 以确保不会错过任何日志。

我正在使用 Rails 5.2.0 和 Ruby 2.3.1p112

提前致谢

【问题讨论】:

标签: ruby-on-rails ruby rubygems


【解决方案1】:

由于某种原因,经过数小时的研究,我现在在 Approot/logs/production.log 中找到了日志,因此是默认的 Rails 日志位置。我真的不知道为什么我事先错过了。可能是因为我更改了日志级别配置的行......

因此,以供将来参考:即使 resque worker 由 systemd 处理,日志仍然可以在环境中配置的应用程序日志记录中找到。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-25
    • 1970-01-01
    • 2017-12-27
    • 1970-01-01
    • 2012-05-31
    • 1970-01-01
    • 2019-08-24
    相关资源
    最近更新 更多