logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Turner, Jay" <Jay.Tur...@sabre-holdings.com>
Subject I need to handle log4j:WARN Unrecognized element param
Date Fri, 15 Jul 2011 22:02:47 GMT
I get "log4j:WARN Unrecognized element param" because we have some extra entries in the log4j
1.2.15 XML configuration file at the root level.

The code uses
DOMConfigurator configurator = new DOMConfigurator();
configurator.doConfigure(inputStream, org.apache.log4j.LogManager.getLoggerRepository());

The LoggerRepository returned doesn't implement UnrecognizedElementHandler (or at least not
that I know how to connect to it).
I thought of using
class ExtendedLoggerRepository extends org.apache.log4j.LoggerRepositoryExImpl {
                public boolean parseUnrecognizedElement(
                        org.w3c.dom.Element element,
                        java.util.Properties props)
                        throws java.lang.Exception {
                        // My code
                new ExtendedLoggerRepository(org.apache.log4j.LogManager.getLoggerRepository()));

But my IntelliJ says that LoggerRepositoryExImpl, which is a public final class, is not in
that package nor the spi subpackage.

What is the right way of using the default logger repository but hooking in so that I can
parse extra parameters as in:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<param name="somename" value="somevalue"/>

Thank you,
Jay Turner

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message