title: Meteor: Debug on server side
body: <p>Does anyone know a good method to debug server side code?
  I tried enable Node.js debug then use node-inspector but it does not show any of my code.</p>
  
  <p>I end up using console.log but this is very inefficient. </p>
  
  <p><strong>Update: I found the following procedure works on my Linux machine:</strong></p>
  
  <ol>
  <li><p>When you run Meteor, it will spawn two processes</p>
  
  <p>process1: /usr/lib/meteor/bin/node /usr/lib/meteor/app/meteor/meteor.js</p>
  
  <p>process2: /usr/lib/meteor/bin/node /home/paul/codes/bbtest_code/bbtest02/.meteor/local/build/main.js --keepalive</p></li>
  <li><p>You need to send kill -s USR1 on process2</p></li>
  <li><p>Run node-inspector and you can see your server code</p></li>
  </ol>
  
  <p>On my first try, I modify the last line on meteor startup script in /usr/lib/meteor/bin/meteor to</p>
  
  <pre><code>exec "$DEV_BUNDLE/bin/node" $NODE_DEBUG "$METEOR" "$@"
  </code></pre>
  
  <p>and run <code>NODE_DEBUG=--debug meteor</code> on command prompt. This only put --debug flag on process1 so I only see meteor files on node-inspector and could not find my code. </p>
  
  <p>Can someone check this on Windows and Mac machine?</p>