Ruby 如何让Heroku从工作进程登录?

Ruby 如何让Heroku从工作进程登录?,ruby,logging,heroku,worker,Ruby,Logging,Heroku,Worker,我试图让Heroku运行一个简单的Ruby进程并写入Logplex 我的文件: worker: ruby test_app.rb test_app.rb: puts 'LOGGGGG!' raise 'we have a problem' sleep(10) 当我运行heroku local时,我得到了预期的输出: forego | starting worker.1 on port 5000 worker.1 | test_app.rb:10:in `<main>': we

我试图让Heroku运行一个简单的Ruby进程并写入Logplex

我的文件:

worker: ruby test_app.rb
test_app.rb:

puts 'LOGGGGG!'
raise 'we have a problem'
sleep(10)
当我运行heroku local时,我得到了预期的输出:

forego  | starting worker.1 on port 5000
worker.1 | test_app.rb:10:in `<main>': we have a problem (RuntimeError)
worker.1 | LOGGGGG!
我可能做错了什么?我不知所措。。。 谢谢 路易丝

编辑:我的推送输出如下所示:

 1 file changed, 1 deletion(-)
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 286 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Using set buildpack heroku/ruby
remote: -----> Ruby app detected
remote: -----> Compiling Ruby
remote: -----> Using Ruby version: ruby-2.2.2
remote: -----> Installing dependencies using bundler 1.9.7
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Using i18n 0.7.0
remote:        Using json 1.8.3
remote:        Using minitest 5.8.3
remote:        Using thread_safe 0.3.5
remote:        Using amq-protocol 2.0.0
remote:        Using concurrent-ruby 1.0.0
remote:        Using connection_pool 2.2.0
remote:        Using netrc 0.7.9
remote:        Using redis 3.2.2
remote:        Using bundler 1.9.7
remote:        Using tzinfo 1.2.2
remote:        Using bunny 2.2.1
remote:        Using rest_client 1.8.3
remote:        Using sidekiq 4.0.1
remote:        Using activesupport 4.2.5
remote:        Bundle complete! 7 Gemfile dependencies, 15 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Bundle completed (0.26s)
remote:        Cleaning up the bundler cache.
remote: -----> Writing config/database.yml to read from DATABASE_URL
remote: 
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types     -> worker
remote:        Default types for buildpack -> console, rake
remote: 
remote: -----> Compressing... done, 18.1MB
remote: -----> Launching... done, v19
remote:        https://application-name.herokuapp.com/ deployed to Heroku
remote: 
remote: Verifying deploy... done.
To git@heroku.com:application-name.git
   75d764d..a7d6bdb  master -> master

部署完成后,是否扩展了工作进程

heroku ps:scale worker=1将启动一个worker进程。这样做你会得到

2015-11-27T18:09:16.366187+00:00 heroku[slug-compiler]: Slug compilation started
2015-11-27T18:09:16.366197+00:00 heroku[slug-compiler]: Slug compilation finished
2015-11-27T18:10:14.409542+00:00 heroku[api]: Scale to web=1, worker=1 by me@me.com
2015-11-27T18:10:16.657359+00:00 heroku[worker.1]: Starting process with command `ruby test_app.rb`
2015-11-27T18:10:17.365815+00:00 heroku[worker.1]: State changed from starting to up
2015-11-27T18:10:18.668842+00:00 app[worker.1]: test_app.rb:3:in `<main>': we have a problem (RuntimeError)
2015-11-27T18:10:18.669815+00:00 app[worker.1]: LOGGGGG!
2015-11-27T18:10:19.493559+00:00 heroku[worker.1]: State changed from up to crashed
2015-11-27T18:09:16.366187+00:00 heroku[段塞编译器]:段塞编译已开始
2015-11-27T18:09:16.366197+00:00 heroku[段塞编译器]:段塞编译完成
2015-11-27T18:10:14.409542+00:00 heroku[api]:按比例缩放到web=1,工人=1me@me.com
2015-11-27T18:10:16.657359+00:00 heroku[worker.1]:使用命令“ruby test\u app.rb”启动进程`
2015-11-27T18:10:17.365815+00:00 heroku[worker.1]:状态从启动更改为启动
2015-11-27T18:10:18.668842+00:00应用程序[worker.1]:test_app.rb:3:in`':我们遇到了一个问题(运行时错误)
2015-11-27T18:10:18.669815+00:00应用程序[工人1]:LOGGGGG!
2015-11-27T18:10:19.493559+00:00 heroku[worker.1]:状态从高变为崩溃
默认情况下,Heroku只会启动
web
过程,您需要放大
worker
过程

2015-11-27T18:09:16.366187+00:00 heroku[slug-compiler]: Slug compilation started
2015-11-27T18:09:16.366197+00:00 heroku[slug-compiler]: Slug compilation finished
2015-11-27T18:10:14.409542+00:00 heroku[api]: Scale to web=1, worker=1 by me@me.com
2015-11-27T18:10:16.657359+00:00 heroku[worker.1]: Starting process with command `ruby test_app.rb`
2015-11-27T18:10:17.365815+00:00 heroku[worker.1]: State changed from starting to up
2015-11-27T18:10:18.668842+00:00 app[worker.1]: test_app.rb:3:in `<main>': we have a problem (RuntimeError)
2015-11-27T18:10:18.669815+00:00 app[worker.1]: LOGGGGG!
2015-11-27T18:10:19.493559+00:00 heroku[worker.1]: State changed from up to crashed