Hi,
I'm writing test cases, using version 2.8 of Log4j.
One test sets a filter on a logger.
Looking (afterwards) at the logger, I see that the logger has a field:
"privateConfig", and that has two fields for configuration info:
- config (set to an instance of XmlConfiguration)
- loggerConfig (has the filter I set on the logger).
The code for isEnabled in Logger (line 238):
public boolean isEnabled(final Level level, final Marker marker, final Object
message, final Throwable t) {
return privateConfig.filter(level, marker, message, t);
}
privateConfig.filter() although it has both a "config" and a "loggerConfig",
only checks the config.
The fact that I successfully used an API to set the loggerConfig with a filter
is ignored.
Should the design for privateConfig.filter() check both configs, or is there
some API call to "merge" the change I did that was recorded in the field
"loggerConfig" into the config stored in the field "config"?
-Marshall Schor
P.S., here's the API call I did to set a filter:
// coreLogger is a cast of a normal logger, to enable the get() method
coreLogger.get().addFilter(myFilter);
// not sure if this is needed, but did it anyways
coreLogger.getContext().updateLoggers();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]