clux / logule

A multi-transport, peer-dependent logging library for nodejs - UNMAINTAINED
MIT License
35 stars 5 forks source link

TypeError('Arguments to path.resolve must be strings') on starting script with supervisord #17

Open Tolsi opened 10 years ago

Tolsi commented 10 years ago

When i start my script with supervisord, i have this error on logule initialise: var log = require('logule').init(module);

        throw new TypeError('Arguments to path.resolve must be strings');
        ^
TypeError: Arguments to path.resolve must be strings
    at Object.exports.resolve (path.js:313:15)
    at Object.exports.relative (path.js:370:20)
    at findFromStart (.../api/node_modules/logule/node_modules/confortable/confortable.js:13:23)
    at module.exports (.../api/node_modules/logule/node_modules/confortable/confortable.js:47:16)
    at Object.<anonymous> (.../api/node_modules/logule/lib/configure.js:9:37)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

But it runs fine manually. My supervisord.conf:

[program:api]
environment = NODE_ENV="production" ....
command = node api.js
directory = .../api/
autostart = true
autorestart = true
redirect_stderr=true
stdout_logfile=.../api/logs/api.log
clux commented 10 years ago

You probably need to set the HOME environment variable for supervisord if you aren't. Looks like confortable is choking because it is trying to use undefined or something bad in the path.resolve. I'm guessing it's that.

https://github.com/clux/confortable/blob/master/confortable.js#L11

Confortable searches for your config file (.logule.json) inside cwd, and keeps looking up in steps of '..' until it hits HOME. If you're not using a config file this SHOULD not cause problems but at the moment it probably will. So there is at least one issue here worth fixing. Thank you.