From e2f0f2e327fc3f3958ca34031cf2331cc5405782 Mon Sep 17 00:00:00 2001 From: Nitin Mohaptra Date: Thu, 17 Apr 2025 23:30:20 +0530 Subject: [PATCH 1/2] Improved error logging: log full error object instead of stack trace --- lib/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/application.js b/lib/application.js index 47be2a20c1a..310e6dfef21 100644 --- a/lib/application.js +++ b/lib/application.js @@ -614,7 +614,7 @@ app.listen = function listen() { function logerror(err) { /* istanbul ignore next */ - if (this.get('env') !== 'test') console.error(err.stack || err.toString()); + if (this.get('env') !== 'test') console.error(err); } /** From 0a6147bd3faa3c8c7d803b82c3cc33c7fe48c208 Mon Sep 17 00:00:00 2001 From: Sebastian Beltran Date: Mon, 15 Jun 2026 15:27:39 -0500 Subject: [PATCH 2/2] docs: update History.md to reflect changes in error logging behavior --- History.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/History.md b/History.md index 9c220451723..c4d20a1e807 100644 --- a/History.md +++ b/History.md @@ -17,6 +17,8 @@ // -> Content-Type: text/plain; foo=bar; charset=utf-8 ``` +* 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) + ## ⚡ Performance * 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)