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

[Bug]: JSON format does not output error message #2470

Open
paul-uz opened this issue May 31, 2024 · 4 comments
Open

[Bug]: JSON format does not output error message #2470

paul-uz opened this issue May 31, 2024 · 4 comments

Comments

@paul-uz
Copy link

paul-uz commented May 31, 2024

🔎 Search Terms

error json format

The problem

The JSON format does not output the error message.

What version of Winston presents the issue?

latest

What version of Node are you using?

20.11.1

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

No response

Additional information

No response

@gokulnath-prabakaran-zoomrx

Facing the same issue

@paul-uz
Copy link
Author

paul-uz commented Jun 5, 2024

I ended up combining the error and json formats. Not great though

@gokulnath-prabakaran-zoomrx

Hi @paul-uz , the above issue was resolved for me. Previously I was logging error object in error key. Now instead of error key rename it to err works
logger.error(msg, { error: ErrorObj });
Converting the above to below works
logger.error(msg, { err: ErrorObj });

@jazanne
Copy link

jazanne commented Nov 4, 2024

Previously I was logging error object in error key. Now instead of error key rename it to err works
logger.error(msg, { error: ErrorObj });
Converting the above to below works
logger.error(msg, { err: ErrorObj });

tried using this workaround, but it didn't fix the issue - anytime I nest an error w/additional data it has an issue

I have also tried:

logger.error(msg, error, {details})
logger.error(msg, {details}, error)

The only way error is successfully printed is if i only pass the err object in like
logger.error(msg, error)

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

No branches or pull requests

3 participants