Using the foreman gem to to start my server and manage various processes is great, and I know that at thoughtbot you folks also use foreman. The problem with using foreman that I’ve found is that it does not show by default my logs in development (or presumably in any mode). I attempted to counter this by running tail -f log/development.log in another window, but then the issue is that I don’t get the benefits of cleaner logs from usage of the gem quiet_assets.
How do you deal with this issue when using foreman?
./bin/setup && foreman start to set up the app and get the server going
exist the session to do my normal Git/Vim work.
when I need to see the logs, tat again
open a second tmux window
tail -f log/development.log
I generally just leave that running until the next time my machine restarts, so if I need to return to the logs, they’re a quick tat away
That has been the right mix for me of information hiding when I don’t need something, and granularity in the 1% case when I need it.
It sounds like foreman start is too quiet and tail -f log/development.log is too noisy for your tastes. I think my advice is to start with tail -f log/development.log and then use Unix pipes and commands to start to filter the results to just what you’re looking for, perhaps building up some sweet aliases over time (which I’d love to see shared back here!).
Some ideas:
alias tail-log="tail -f log/development.log
tail-log | ag 'SELECT':
User Load (1.2ms) SELECT "users".* FROM "users" WHERE "users"."remember_token" IS NULL ORDER BY "users"."id" ASC LIMIT 1
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."remember_token" IS NULL ORDER BY "users"."id" ASC LIMIT 1
Wow, thank you. That’s a great idea for really narrowing down what you want to see in your logs. I’ll definitely share what else I come up with. Thanks again!