2017-01-14 1 views
-1

J'ai un serveur utilisant Ruby, Sinatra, Unicorn et nginx. J'ai vécu un accident récemment, ce qui re-production de la question lors de l'exécution dans le Terminal, je peux le voir produit ce journal crash:Serveur nginx avec Unicorn et Sinatra ne pas enregistrer les plantages

/Users/Andrew/.rvm/gems/ruby-2.3.0/gems/tweetstream-2.6.1/lib/tweetstream/client.rb:449:in `block in connect': Failed to reconnect after 6 tries. (TweetStream::ReconnectError) 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/em-twitter-0.3.5/lib/em-twitter/connection.rb:297:in `invoke_callback' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/em-twitter-0.3.5/lib/em-twitter/connection.rb:269:in `rescue in schedule_reconnect' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/em-twitter-0.3.5/lib/em-twitter/connection.rb:264:in `schedule_reconnect' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/em-twitter-0.3.5/lib/em-twitter/connection.rb:92:in `unbind' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:1483:in `event_callback' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:194:in `run_machine' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/eventmachine-1.2.0.1/lib/eventmachine.rb:194:in `run' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/thin-1.7.0/lib/thin/backends/base.rb:73:in `start' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/thin-1.7.0/lib/thin/server.rb:162:in `start' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/handler/thin.rb:19:in `run' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1506:in `start_server' 
    from /Users/Andrew/.rvm/gems/ruby-2.3.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1444:in `run!' 
    from server.rb:234:in `<main>' 

Mais quand je cherchais un journal d'erreurs plus tôt, je ne pouvais pas trouver quoi que ce soit comme ci-dessus.

Mon fichier /etc/nginx/nginx.conf montre ce que l'emplacement des journaux:

access_log /var/log/nginx/access.log; 
    error_log /var/log/nginx/error.log; 

Mais je vais à ces deux répertoires, et le journal d'accès affiche simplement toutes les demandes, Je m'attendrais, et le journal des erreurs est vide.

Si mes journaux sont stockés ailleurs, comment puis-je déterminer où ils se trouvent? Ou si c'est pour une raison ou une autre, ne pas enregistrer les plantages, comment puis-je m'assurer que c'est le cas?

Répondre

1

Je vous suggère de définir un journal stderr et stdout pour licorne dans le fichier unicorn.rb.

# set path to app that will be used to configure unicorn, 
# note the trailing slash in this example 
@dir = File.dirname(__FILE__) + '/' 

worker_processes 2 
working_directory @dir 

timeout 30 

# Specify path to socket unicorn listens to, 
# we will use this in our nginx.conf later 
listen "/home/vagrant/sockets/unicorn.sock", :backlog => 64 

# Set process id path 
pid "#{@dir}tmp/pids/unicorn.pid" 

# Set log file paths 
stderr_path "/var/log/unicorn/stderr.log" 
stdout_path "/var/log/unicorn/stdout.log"