Skip to content
Myr

Improve error logging by logging full error object (#6464)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Improved error logging: log full error object instead of stack trace * docs: update History.md to reflect changes in error logging behavior ---------

authored by Nitin Mohapatra · committed by GitHub · parent cb19f04 · Browse files · 2 files+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Sebastian Beltran <bjohansebas@gmail.com>

Diff stats

2 files+3 added−1 removed

  • other:+3 added−1 removed

2 files+3 added−1 removed

modified:lib/application.js+1 added-1 removed
612 unmodified lines
613 */614615function logerror(err) {616 /* istanbul ignore next */617 if (this.get('env') !== 'test') console.error(err.stack || err.toString());617 if (this.get('env') !== 'test') console.error(err);618}619620/**621 * Try rendering a view.
10 unmodified lines
modified:History.md+2 added
15 unmodified lines
16 res.set('Content-Type', 'text/plain; foo=bar').send('hey');17 // -> Content-Type: text/plain; foo=bar; charset=utf-818 ```1920* The default error handler now logs the full error object instead of only its stack trace, so nested details such as `Error.cause` and library-specific properties (e.g. Sequelize's `parent`/`original`) are no longer swallowed - by [@Nitin-Mohapatra](https://github.com/Nitin-Mohapatra) in [#6464](https://github.com/expressjs/express/pull/6464)2122## ⚡ Performance2324* Avoid duplicate Content-Type header processing in `res.send()` when sending string responses without an explicit Content-Type header - by [@bjohansebas](https://github.com/bjohansebas) in [#6991](https://github.com/expressjs/express/pull/6991)25
3871 unmodified lines