Log4j: Changing XML with DOMConfigurator?
I am using log4j with Java and wanted to configure my XML-Config-File (I need to use XML for the ErrorHandler), so that some Properties in the XML (like the Backup-Value for th开发者_StackOverflow社区e RollingFileAppender) could be changed within the DOMConfigurator of the log4j-API. This class also got the subst()-method, which should substitute the chosen values, but I really don´t know how to handle it.
If their is no way changing the config with the DOMConfigurator, which else possibilities did I got to easily correct values in an ambiguous XML-File (So to say, because the XML-Tags are not unique or only their Tag-names, which are values itself)? My XML is kind of static or hand-written.
Why can't you fix the original XML file on the disk?
If for some reason that's not possible, I would rather try altering the configuration directly via Logger
, after the config file has been loaded.
精彩评论