-
Hey Quarkus community and team! Is there any way, how can I configure different log levels for categories and different log handlers? I mean, I'd like to set the logger level differently for log handlers. Example:
And simultaneously still respect the root level for other loggers ( It might be doable by leveraging filters, but I'm wondering, whether there's a better approach. cc: @dmlloyd |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Normally you would set the category level to the most detailed level that you want to appear in any log. Then you'd set the level on each handler to the most detailed level that you want to see for that particular destination. So e.g. your console log would globally have a level of There isn't a built-in category×handler level table. The reason is that each category and each handler can store the target level as an integer, and can filter the messages using a fast integer comparison (which is important, especially for For this reason, the best approach is to start as above by setting your category levels first, and then your handler levels. Then, if there are still certain messages which are leaking through which you don't want, applying a filter to the handler which filters down certain categories (with e.g. a string switch) would be the next logical step. If you end up in a situation where you have a very large number of these exceptional cases to consider, we could potentially revisit this as some kind of feature enhancement where individual category configurations could specify levels per handler. |
Beta Was this translation helpful? Give feedback.
-
@dmlloyd Thanks for your comment.
I'm not sure if this is the way we want to go, as it might become quite fragile, and also the maintainability would not be very good. Especially handling these exceptional cases. For Keycloak, we'd like to have the possibility to manage the categories for each individual log handler separately to provide more fine-grained log level settings. It means that, for instance, for console, we'd like to have
IMHO, it might be very useful to have the ability to specify log level for category per log handler and it would be great to revisit and create an RFE. I've been trying to provide such functionality with the help of Filters in Keycloak, and it works fine. I made only a brief performance analysis for handling Here is the PR: https://github.com/keycloak/keycloak/pull/32620/files#diff-fb502b5da4f070cc324f0ad9a7fc495e1b06e5fafc4979dd1ed17a079dc7cf7aR34. It would be great if you could provide some feedback on the used filters as you have more expertise than me. Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
I think the idea is basically sound. I would suggest that you ensure that |
Beta Was this translation helpful? Give feedback.
-
@dmlloyd Can we transfer this discussion to RFE? It'd be great for us to have such capabilities included in Quarkus instead of making some workarounds in Keycloak. By transferring it into the RFE, we could see whether somebody else has the same requirements and if it's wanted by the community. WDYT? Do you think the category×handler level table would introduce any big major performance degradation? |
Beta Was this translation helpful? Give feedback.
-
Moved to RFE issue: #43147 |
Beta Was this translation helpful? Give feedback.
Moved to RFE issue: #43147