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

All logs show as INFO #393

Open
Marcovecchio opened this issue Aug 15, 2024 · 0 comments
Open

All logs show as INFO #393

Marcovecchio opened this issue Aug 15, 2024 · 0 comments

Comments

@Marcovecchio
Copy link

Marcovecchio commented Aug 15, 2024

I'm facing an issue, where all my request logs (processed thru lograge) have the INFO log_level, so I can't filter errors, warns and infos. Looking into the source code, we see that it calls the logger method here, using the Lograge.log_level class variable:

logger.send(Lograge.log_level, formatted_message)

Well, this other line will define what is in Lograge.log_level. It will either use a configured (and fixed) log_level, or falls back to :info, which is what's happening to me, since I don't have any log_level configured:

Lograge.log_level = lograge_config.log_level || :info

My conclusion is that lograge seems to have a fixed log_level, but I need each request log to follow the http status code, otherwise filtering will be harder and non intuitive: it makes no sense to have a 500 error logged as INFO.

We can do a workaround by setting Lograge.log_level to a different level every time a new log is created, but is this the correct way to do it? Does lograge offer a better solution?

Thanks!

@Marcovecchio Marcovecchio changed the title All logs shows as INFO All logs show as INFO Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant