Bug 43325 - Subst-mechanism in DOMConfigurator broken
Subst-mechanism in DOMConfigurator broken
Product: Log4j
Classification: Unclassified
Component: Configurator
Other other
: P2 normal
: ---
Assigned To: log4j-dev
Depends on:
Blocks: 43313
  Show dependency tree
Reported: 2007-09-07 02:58 UTC by Lars Beuster
Modified: 2007-10-22 13:33 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Lars Beuster 2007-09-07 02:58:49 UTC
With the new 1.2.15 release the subst-mechanism doesn't work in all cases.

Prior the 1.2.15 release I could override the protected instance method
DOMConfigurator.subst(String) to delegate all value substitutions to my own
properties object. Per default the original subst()-method calls another static
Now the setParameter()-method calls the static subst()-method directly and the
instance-method isn't called anymore.

The other subst-mechanism with the member "properties" fails because that member
is package protected and has no setter. Even log4j doesn't set the member to any
value - so it's always null.

Comment 1 Curt Arnold 2007-10-22 13:33:25 UTC
Added unit test and fix in rev 587235.  DOMConfigurator.subst() should now be consulted in all the places 
it was in log4j 1.2.14.  

It will not be consulted when processing unrecognized elements, the parseUnrecognizedElement method 
of the appender (or other object) is passed a Properties object and does not have access to the 
DOMConfigurator.  If you want to interact with the property evaluation of unrecognized elements, then 
you have to tweak the Properties object passed on parseUnrecognizedElement.