title: Logging stdout and stderr of Node
body: <p>I am using the boilerplate code of <a href="http://mean.io" rel="noreferrer">mean.io</a> and starting my server with the command:</p>
  
  <pre><code>node server.js
  </code></pre>
  
  <p>How do I log <code>stdout</code> and <code>stderr</code> of my Express application?</p>
  
  <p>Here's my file <code>server.js</code>: </p>
  
  <pre class="lang-js prettyprint-override"><code>'use strict';
  
  /**
   * Module dependencies.
   */
  var mongoose = require('mongoose'),
      passport = require('passport'),
      logger = require('mean-logger');
  
  /**
   * Main application entry file.
   * Please note that the order of loading is important.
   */
  
  // Initializing system variables
  var config = require('./server/config/config');
  var db = mongoose.connect(config.db);
  
  // Bootstrap Models, Dependencies, Routes and the app as an express app
  var app = require('./server/config/system/bootstrap')(passport, db);
  
  // Start the app by listening on &lt;port&gt;, optional hostname
  app.listen(config.port, config.hostname);
  console.log('Mean app started on port ' + config.port + ' (' + process.env.NODE_ENV + ')');
  
  // Initializing logger
  logger.init(app, passport, mongoose);
  
  // Expose app
  exports = module.exports = app;
  </code></pre>