nodester / nodester

Open Source Node.js Hosting Platform
http://nodester.com
Other
770 stars 123 forks source link

"nodester app logs <myapp>" repeatedly throws an error #175

Closed olkensey closed 12 years ago

olkensey commented 12 years ago

New to all this, but got the following. This repeats about 9 times before aborting the process.

$ nodester app logs omniverse

server.js { Connecting on port 11252 socket.io { info - socket.io started } socket.io omni.node.js { } omni.node.js } server.js

[_NOTE: above is output from my program. It seems to be starting/ finishing ok. _]

undefined:8

+ (tokens["reply-time"](req, res, "undefined") || "-") + " ms)";

^

TypeError: Object function logger(options) { if ('object' == typeof options) { options = options || {}; } else if (options) { options = { format: options }; } else { options = {}; }

// format name var fmt = exports[options.format] || options.format || exports.default;

// compile format if ('function' != typeof fmt) fmt = compile(fmt);

// options var stream = options.stream || process.stdout , buffer = options.buffer;

// buffering support if (buffer) { var realStream = stream , interval = 'number' == typeof buffer ? buffer : defaultBufferDuration;

// flush interval
setInterval(function(){
  if (buf.length) {
    realStream.write(buf.join(''), 'ascii');
    buf.length = 0;
  }
}, interval); 

// swap the stream
stream = {
  write: function(str){
    buf.push(str);
  }
};

}

return function logger(req, res, next) { req._startTime = new Date;

// mount safety
if (req._logging) return next();

// flag as logging
req._logging = true;

// proxy end to output loggging
var end = res.end;
res.end = function(chunk, encoding){
  res.end = end;
  res.end(chunk, encoding);
  stream.write(fmt(exports, req, res) + '\n', 'ascii');
};

next();

}; } has no method 'reply-time' at anonymous (eval at compile (/node_modules/connect/lib/middleware/logger.js:158:10)) at ServerResponse. (/node_modules/connect/lib/middleware/logger.js:138:20) at [object Object].onend (stream.js:74:10) at [object Object].emit (events.js:81:20) at afterRead (fs.js:878:12) at wrapper (fs.js:245:17)

Process died with exit code 1. Restarting...

On a possibly related note, whenever I try to access my app at omniverse.nodester.com, I get the following: An error has occurred: {"stack":"Error: ECONNREFUSED, Connection refused\n at Socket._onConnect (net.js:601:18)\n at IOWatcher.onWritable as callback","message":"ECONNREFUSED, Connection refused","errno":111,"code":"ECONNREFUSED","syscall":"connect"}

At best, I get my index.html page and then a bunch of internal server errors for the rest of my files. Maybe it's just a bad day for nodester.

yocontra commented 12 years ago

The Connect log error appears to be an issue with your code. Can you provide any snippets where Connect logging is used? You should also try updating to the latest version of Connect, I've read a few reports of this being a bug in older versions

olkensey commented 12 years ago

Thanks for the tip-- I'd assumed the error laid outside my code since it seemed to execute without issue. I have to assume that it's nodester that's running an older version of connect since I don't get the error on my side and "nodester npm install connect" doesn't resolve the error.

Here's the offending line:

  Connect.logger({format: ':method :url :status mapHTTP:http-version :remote-addr (:reply-time ms)'}),

I guess my "issue" should read UPDATE TO THE LATEST PACKAGES POR FAVOR.

yocontra commented 12 years ago

Looked into it a little more. You should have a quick read of http://senchalabs.github.com/connect/middleware-logger.html

You should be using :response-time instead of :reply-time in your code to fix the issue (The Connect version shouldn't matter).

Let me know if that works