Getting annoying logging with stacktrace.
See original GitHub issueIf I send a request without any authorization token, express logs an error to the console.
UnauthorizedError: No authorization token was found
at middleware (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express-jwt/lib/index.js:75:21)
at Layer.handle [as handle_request] (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:312:13)
at /home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:330:12)
at next (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:271:10)
at expressInit (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/middleware/init.js:33:5)
at Layer.handle [as handle_request] (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:312:13)
at /home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:330:12)
at next (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:271:10)
at query (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/middleware/query.js:44:5)
at Layer.handle [as handle_request] (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:312:13)
at /home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:330:12)
at next (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:271:10)
at Function.handle (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/router/index.js:176:3)
at EventEmitter.handle (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/application.js:173:10)
at Server.app (/home/levin/coding/satoshipay/nano-btc-vendor/server/node_modules/express/lib/express.js:38:9)
at emitTwo (events.js:106:13)
at Server.emit (events.js:191:7)
at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
The error itself is fine for me, I handle it in an appropiate middleware, but I do NOT want this stacktrace to be logged. I cannot find where to switch it off or which package is actually logging this stuff. I am also using express-jwt-authz
and express-jwt-permissions
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:26 (4 by maintainers)
Top Results From Across the Web
How to remove the error stack traces from logging - Laracasts
I'm looking for a way to make sure the error is posted, but only the error, not the stack trace.
Read more >printStackTrace to java.util.logging.Logger - Stack Overflow
The first argument is a message to be displayed, the second is the exception (throwable) whose stacktrace is logged. Another option is commons- ......
Read more >No stack trace in production log - Questions / Help - Elixir Forum
I try to connect to the running app and enable debug log Logger.configure(level: :debug) . This helps a bit but I still don't...
Read more >Debug.Log Stacktrace Spam - Unity Forum
If you want to disable the stack trace for Debug.Log entirely, you can do that in Player Settings under the "Other Settings" category...
Read more >When Stack Traces Aren't Useful… - Jacob Zivan Design
It is better, but, I still find them cumbersome. The fact that we need to translate the stack trace into something useful while...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Levino you didn’t read my message here and you didn’t read the README file of the project. Again:
For instance change your test to this:
Stack traces are definitely a security liability. Search for easy way to suppress landed me here.
app.use(fn)
chaining method used in docs which @jfromaniello references above didn’t work for me usingexpress@4.16.2
However, when I ended up using middleware functions as arguments to
app.get()
it works as I was hoping for:Hope that helps someone else. If maintainers like, I would be happy to submit a quick PR to update docs with the suggestion ✌️