A while back some people expressed a need for configuring message bundles
with categories via property files or XML files (I can't remember which).
It would be easy to provide this ability for XML configuration now that we
use the Java Bean convention of configuration.
For property files, because of the unique structure of the category line,
this may not be possible the way things are now. However, the next best
thing would be to follow the manner in the appserver package whereby the
message bundle is configured on the category factory instead of a
particular category. One misses the flexability of configuring a separate
message bundle for each category, but for cases where a single message
bundle suffices, it will do the job.
This would require modification of DefaultCategoryFactory to accept a
message bundle in its configuration - easy enough. The sensitive part is
how to associate the DefaultCategoryFactory to the Hierarchy. There is a
setCategoryFactory method on the Hierarchy class that I think is left over
from when I was wanting to set custome category factories on the Hierarchy.
Ceki was opposed to the idea of encouraging this kind of access to the the
hierarchy at the time; so I did something different for the customized
category case.
I would like to propose modifying
PropertyConfigurator.configureCategoryFactory(Properties) to set the
Hierachy's default category factory whenever the factory is an instance of
DefaultCategoryFactory. This would allow DefaultCategoryFactory to be
configured with a message bundle and associated with the Hierarchy. It
would not affect the Hierachy in customized cases.
Property file users could set a message bundle in the following way:
log4j.categoryFactory=org.apache.log4j.DefaultCategoryFactory
log4j.factory.messageBundle=MyLocalizations
This would cause a classpath search for MyLocalizations.properties. If
found, the resulting message bundle would be associated with the
DefaultCategoryFactory and set on each Category it created.
- Paul
Paul Glezen
IT Specialist
Software Services for WebSphere
818 539 3321
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]