me.at.coding
me.at.coding

Reputation: 17654

Filter messages on method level?

In log4j, is it possible to filter not only on a package / class level, but also on a method level? If yes, how?

Thanks for any hint :-)

Upvotes: 0

Views: 72

Answers (1)

vptheron
vptheron

Reputation: 7466

In log4j you do not "filter" (I assume you refer to the config where you define the log levels per logger) per package or class, you filter per logger name.

It just happens that most of the time one uses the name of a class to instantiate a logger, so the name of the logger ends up being the canonical name of the class. You can just give any name to your logger and then use this name to configure it.

Upvotes: 1

Related Questions