2

我正在使用 sidekiq 管理视图,它是安装在 rails 应用程序内的 Sinatra 应用程序。当我点击管理面板查看我的后台作业时,我得到了很多关于资产的输出,例如:

    16:36:57 web.1    | Started GET "/sidekiq" for 127.0.0.1 at 2013-07-18 16:36:57 -0700
    16:36:57 web.1    | 
    16:36:57 web.1    | 
    16:36:57 web.1    | Started GET "/sidekiq/stylesheets/bootstrap.css" for 127.0.0.1 at 2013-07-18 16:36:57 -0700
    16:36:57 web.1    | 
    16:36:57 web.1    | 
    16:36:57 web.1    | Started GET "/sidekiq/javascripts/application.js" for 127.0.0.1 at 2013-07-18 16:36:57 -0700
    16:36:57 web.1    | 
    16:36:57 web.1    | 
    16:36:57 web.1    | Started GET "/sidekiq/stylesheets/application.css" for 127.0.0.1 at 2013-07-18 16:36:57 -0700
    16:36:57 web.1    | 
    16:36:57 web.1    | 
    16:36:57 web.1    | Started GET "/sidekiq/javascripts/dashboard.js" for 127.0.0.1 at 2013-07-18 16:36:57 -0700
    16:36:57 web.1    | 
    16:36:57 web.1    | 
    16:36:57 web.1    | Started GET "/sidekiq/images/status-sd8051fd480.png" for 127.0.0.1 at 2013-07-18 16:36:57 -0700
    16:36:59 web.1    | 
    16:36:59 web.1    | 
    16:36:59 web.1    | Started GET "/sidekiq/retries" for 127.0.0.1 at 2013-07-18 16:36:59 -0700
    16:36:59 web.1    | 
    16:36:59 web.1    | 
    16:36:59 web.1    | Started GET "/sidekiq/stylesheets/bootstrap.css" for 127.0.0.1 at 2013-07-18 16:36:59 -0700
    16:36

有没有办法把它排除在我的 Rails 日志之外?或者把它放在一个单独的日志文件中?

4

1 回答 1

0

如何启动 Sinatra 应用程序?例如,如果您使用独角兽application.rb,您可以在:

require 'sinatra'
require ...

class Application < Sinatra::Base
     configure do
     set :logging, true
     end

end

unicorn.rb用作配置文件的文件中,您可以为此 sinatra 应用程序定义日志目录,例如:

[...]

# Set log file paths
stderr_path "#{@dir}log/unicorn.stderr.log"
stdout_path "#{@dir}log/unicorn.stdout.log"

您可以对每个基于机架的 http 服务器执行相同的操作。请注意,保留日志的是 RACK,而不是 'sinatra' 本身 :-)

希望这可以帮助。

于 2013-07-20T09:35:43.413 回答