How can I change the log-level at runtime *without restarting* or creating 
new forks?

I was thinking of having a controller that - with proper authentication- 
allows a user to set the log level of a specific server, i.e. the server 
the controller resides on. 
Because we are in a threaded environment changing the log level of one 
thread would not affect the others (correct me if I am wrong) so I was 
thinking I write the new log level to a file.
To not waste time reading the file on each log request I was thinking about 
setting a "global" persistent-across-requests variable that has the time of 
the last check and if more than 10s elapsed it reads the file again and 
sets the log level to the value in the file, if this is a valid one.

The usecase is that let's say 20 servers are running and an API call may 
return corrupted data or has a huge performance spike. So now I want to 
turn on a logging level that shows me i.e. the queries that were executed, 
and if that does not help, show even more data that is saved on "debug" 
level.  When there are no problems I want to restrict the logging to 
"error" so no unnecessary logging takes place and wastes cpu/space.

Any thoughts on this method or if there is a better one?


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/19577d60-5f4b-4e2a-8b6d-ac139c44cd8e%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to