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

Error logging is broken, or unintuitive #774

Closed
nijikokun opened this issue Dec 9, 2015 · 7 comments
Closed

Error logging is broken, or unintuitive #774

nijikokun opened this issue Dec 9, 2015 · 7 comments

Comments

@nijikokun
Copy link

I have been trying to re-create the same result as doing a throw err for the past thirty minutes with zero results. I've read the code, it looks as though should the meta object contain the exception (error object) it will return the same stack. Wrong. It does not.

http://dump.nexua.org/Screen_Shot_2015-12-09_at_12.12.47_PM.png

The top, is the global.log.error(err), the bottom is the throw err, wow, look at how much more information is displayed, not to mention you even get the error and stack from the throw err:

https://i.imgur.com/lURWkEF.png

Here is the (full) code:

mongoose.connection.on('error', function (err) {
  global.log.error(err)
  throw err
})

I have also tried:

global.log.log('error', { meta: err })

At least using that I get... the error message, that's it.

How do you log new Error objects properly? It is a mystery at this point, throwing them seems to be my best option, and that makes me feel extremely dirty.

@alexandrubau
Copy link

I think that Error is not being detected as metadata. I've also noticed this behaviour with big objects, not only Error.

@alexandrubau
Copy link

I think it's related to #280. Should be reopened.

@nijikokun
Copy link
Author

Yes, as it was not fixed @indexzero please comment, as this is critical 🔥

@indexzero
Copy link
Member

This is not related to #280. It's something else which happens to have the same symptom.

@nijikokun
Copy link
Author

is there any update @indexzero ?

@alexandrubau
Copy link

@nijikokun I hope they merge #777. Seems to be a fix.

@indexzero
Copy link
Member

Duplicate of #745. Locking this issue as a point of process for duplicate issues.

@winstonjs winstonjs locked and limited conversation to collaborators Feb 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants