Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug log written to stderr #556

Closed
VipSaran opened this issue Feb 22, 2015 · 5 comments
Closed

Debug log written to stderr #556

VipSaran opened this issue Feb 22, 2015 · 5 comments

Comments

@VipSaran
Copy link
Contributor

Test case:

var logger = require('winston');
logger.remove(logger.transports.Console);
logger.add(logger.transports.Console, {'timestamp': true, 'showLevel': false, 'level': 'debug'});

logger.info('info');
logger.debug('debug');
logger.error('error');

Output:

$ node test-winston.js 2>/dev/stdout 1>/dev/null
2015-02-22T11:37:59.072Z - debug: debug
2015-02-22T11:37:59.203Z - error: error

$ node test-winston.js 1>/dev/stdout 2>/dev/null 
2015-02-22T11:40:56.820Z - info: info

Expected result (disregarding the timestamp copy/paste) would be:

$ node test-winston.js 2>/dev/stdout 1>/dev/null
2015-02-22T11:37:59.203Z - error: error

$ node test-winston.js 1>/dev/stdout 2>/dev/null 
2015-02-22T11:40:56.820Z - info: info
2015-02-22T11:37:59.072Z - debug: debug

Winston version: 0.9.0,
Node.js version: 0.10.18.

@indexzero
Copy link
Member

Interesting. Nothing in the code looks wrong. Could you add a javascript-based test to our suite?

@VipSaran
Copy link
Contributor Author

It's a feature, not a bug 👍
Although an undocumented feature 👎
The pull request contains the README update.

indexzero added a commit that referenced this issue Mar 8, 2015
fix for 'showLevel' value not being used in Console transport (#557) and description of debugStdout usage for Console Transport (#556)
nimrod-becker added a commit to nimrod-becker/winston that referenced this issue Mar 11, 2015
@iongion
Copy link

iongion commented Dec 4, 2015

How can this be avoided ? It confuses some test runners such as cucumber-js

@briantanner
Copy link

why is it a feature to spam my error logs with debug logs?

@uwefassnacht
Copy link

uwefassnacht commented Jan 23, 2017

This behaviour is also very confusing on Cloud Foundry based platforms (e.g. IBM Bluemix). The standard debug log messages are all classified as errors :-(

Took me a while to find #927 ... which explains that it can be configured via the stderrLevels parameter (which I've now done). Still a bit unexpected, that the default behavior is for INFO level messages to route to stdout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants