Puma - show full logs when run server with config file

前端 未结 4 2055
故里飘歌
故里飘歌 2021-02-19 03:09

I installed puma gem and when I start rails server by rails s I can see full output:

$ rails s 
/Users/serj/.rvm/gems/ruby-2.2.1@email_         


        
相关标签:
4条回答
  • 2021-02-19 03:48

    If you use foreman or a Procfile, you can add the tail -f log to your Procfile. This is what I use:

    # Procfile.dev
    web: bundle exec puma -p $PORT
    webpack: bin/webpack-dev-server
    log: tail -f log/development.log
    

    I then start rails like this:

    $> PORT=3000 foreman start -f Procfile.dev
    

    I actually have an alias for this in my .zshrc:

    alias railss='PORT=3000 foreman start -f Procfile.dev'
    

    So I can simply start Rails with:

    $> railss
    
    0 讨论(0)
  • 2021-02-19 03:54

    The logs are in log/<rails env>.log. So you could (in a separate tab / window) run:

    tail -f log/development.log
    

    And you'll see all your output. If you want the output from rails merged into the puma logs, you could always have rails log to STDOUT:

    config.logger = Logger.new(STDOUT)
    
    0 讨论(0)
  • 2021-02-19 04:04

    If it's the logs you're interested in, then you can tail the actual log file. It'd go something like this tail -f log/development.log.

    0 讨论(0)
  • 2021-02-19 04:11

    I've found this command in the Puma github readme:

    $rails s Puma
    

    Which also results in the desired behavior.

    Edit: In fact, as described here after installing Puma, it should automatically be picked up by rails s command without the Puma argument.

    0 讨论(0)
提交回复
热议问题