console.errorbeing reported as
level: "info"in observability logs
2 years ago
hi there,
console.error(...)'s in my source code are being reported as level: "info" in the Railway observability logs. This is obviously not ideal and seems like odd behavior, as I'm unable to filter for or see errors easily.
does anyone have any suggestion on why this could be happening?
thanks very much.
2 Replies
2 years ago
console.error does indeed print to stderr so you would think it should be shown as level error, but there are countless other services that print their info logs to stderr too, so it does make some sense for them to still be regarded as an info print, postgres for example prints info logs to stderr.
But I would highly recommend JSON structured logging, Railway has amazing support for that and all the levels will be correct and correctly coloured!
Status changed to Solved Railway • almost 2 years ago
2 years ago
Thanks, brody - I'll pivot to JSON structured logging as that will indeed be an improvement. I appreciate the response.