Add `Exclude` key to Logbox Categories to Easily Exclude Appenders

Description

It would be convenient to be able to easily exclude appenders from Logbox categories. It would make it easier for developers to introduce niche or specialized appenders to their apps without having to explicitly name every appender in the appenders key.

For example, lets say you have an app with 3 appenders, coldboxTracer dbAppender and slackAppender.
Currently if you want all appenders to fire except the slackAppender you have to explicitly name the appenders in the configuration like this:

Having to explicitly name every appender you want can quickly become cumbersome and difficult to manage as the number of appenders grows. Additionally, sometimes you can get into a “chicken and egg” race condition where the category registers itself before the appender and you can get an exception error saying a particular appender doesn’t exist.

A nice solution would be the ability to exclude appenders in a similar fashion as wirebox populator and mementifier by specifying a special key called exclude, which would automatically filter the list of appenders without extra typing or the risk of race conditions.

With the proposed improvement, the same configuration above could be written like this:

Much easier to read and manage!

Now, I’m not 100% sure, but this improvement might be able to be obtained by updating the getAllAppenders() method in LogBoxConfig.cfc and simply filter() based on the exclude property value.

Activity

Show:

David Levin September 30, 2023 at 10:58 PM

You betcha! I created the following PR:

Luis Majano September 14, 2023 at 10:18 AM

I like this do you want to take a crack at it and send me a PR?

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created August 26, 2023 at 8:09 PM
Updated October 13, 2023 at 2:45 PM
Resolved October 13, 2023 at 2:45 PM