Richie
Richie

Reputation: 5199

log4j2.xml - How to exclude category

I have two AsyncLoggers inside my log4j2.xml file. They both have the same prefix of esb.api-vehicle-registration-v1.

    <!-- API specific Groovy files -->
    <AsyncLogger name="esb.api-vehicle-registration-v1.get-registration.web-service-response-validate.groovy" level="OFF"/>

    <!-- API specific log messages -->
    <AsyncLogger name="esb.api-vehicle-registration-v1" level="DEBUG"/>

Is it possible to change the first AsyncLogger definition to use a wildcard like so...

    <AsyncLogger name="esb.api-vehicle-registration-v1.get-registration.*.groovy" level="OFF"/>

I'm asking because I have log output from a number of *groovy categories I would like to exclude.

I did try it but it didn't seem to work.

Upvotes: 0

Views: 826

Answers (1)

Remko Popma
Remko Popma

Reputation: 36784

I would create normal Logger configuration entries for the categories that you want to exclude. Wildcards will not work. Instead, you can specify the category prefix and all categories with that prefix will be filtered by log level. If some subcategories need a different log level filter you can specify them separately.

Upvotes: 1

Related Questions