I am trying to get the debugger gem working with shotgun, and for the debugger to work I need the thin server to be started with “Debugging ON”.
If I run either:
shotgun -p 1378 -s thin -d -o 0.0.0.0
shotgun -p 1378 -s thin --debug -o 0.0.0.0
I get shotgun starting with the $DEBUG ruby variable being set to true, instead of having the thin server being started with the debug flag on.
If I run:
shotgun -pp 1378 -s "thin --debug" -o 0.0.0.0
I get an error. Is there another way to run this, or some way to tell thin to start in debugger mode when the environment is set to development?
Your
-dand--debugoptions are being interpreted by Shotgun, rather than Thin, and that is what is setting$DEBUGto true.Thin’s command line flag to turn on debugging is
-Dor--debugand this setsThin::Logging.debugto true. You can’t use thethincommand line options (sine the command line is being read byshotgunwhich launches the server), but you can set this variable with some normal Ruby code. One way to do this would be with ashotgun.rbfile that requires Thin and changes the setting:(You might want to put this in a
begin...rescue...blockand rescue the LoadError in case Thin isn’t available.)The output without this file:
and with the file:
As far as I can tell, this setting only affects the verbosity of Thin’s logging, and doesn’t have anything to do with the Debugger gem.