logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <christian.hueb...@lhsystems.com>
Subject Multiple loggers in FallbackErrorHandler lead to closed Appender
Date Fri, 13 Apr 2007 08:34:46 GMT
Hello,

maybe I found an Issue using the FallbackErrorHandler of Log4j with multiple Logger instances.

Sorry, if my description is very long:

I have several queues that i want to log with their own priorieties. So I defined for every
queue ist own logger.

I'm logging to a topic and in case this fails, i want to log to a file.

Therefore i configured my Appender this way:

<appender name="JMS_CORELOG"
		class="org.apache.log4j.net.JMSAppender">
		<errorHandler
			class="org.apache.log4j.varia.FallbackErrorHandler">
			<logger-ref ref="MSG_FLOW" />
			<logger-ref ref="LOGGER_AC" />
			<logger-ref ref="LOGGER_BD" />
			<logger-ref ref="LOGGER_CA" />
			<logger-ref ref="LOGGER_FM" />
			<logger-ref ref="LOGGER_JK" />
			<logger-ref ref="LOGGER_LH" />
			<logger-ref ref="LOGGER_LO" />
			<logger-ref ref="LOGGER_LX" />
			<logger-ref ref="LOGGER_NH" />
			<logger-ref ref="LOGGER_NZ" />
			<logger-ref ref="LOGGER_OS" />
			<logger-ref ref="LOGGER_OZ" />
			<logger-ref ref="LOGGER_SA" />
			<logger-ref ref="LOGGER_SK" />
			<logger-ref ref="LOGGER_SQ" />
			<logger-ref ref="LOGGER_TG" />
			<logger-ref ref="LOGGER_TP" />
			<logger-ref ref="LOGGER_UA" />
			<logger-ref ref="LOGGER_US" />
			<appender-ref ref="FILE" />
		</errorHandler>
		<param name="InitialContextFactoryName"
			value="weblogic.jndi.WLInitialContextFactory" />
		<param name="ProviderURL" value="t3://localhost:7001" />
		<param name="TopicBindingName" value="jms/topic/DU_CORE" />
		<param name="TopicConnectionFactoryBindingName"
			value="jms/TopicConnectionFactory" />
		<param name="LocationInfo" value="false" />
		<layout class="org.apache.log4j.PatternLayout">
			<param name="ConversionPattern"
				value="%d{yyyy.MM.dd HH:mm:ss,SSS} %-5p %m%n" />
		</layout>
	</appender>

Now it happens, when log4j is initializing ist configuration, the topic isn't reachable. So
the FallbackErrorHandler switches the appender to file in all categories.

This causes the following behaviour:
Loading from XML the first Category MSG_FLOW it intializes the appender JMS_CORELOG. That
fails and all Categories are switchet to FILE. Then the parsing of XML continues and my Category
LOGGER_AC gets initialized.
DOMConfigurator.parseChildrenOfLoggerElement(Element catElement, Logger cat, boolean isRoot)
calls now cat.removeAllAppenders(). But becuase of the FallbackErrorHandler LOGGER_AC has
Appender FILE already set. So it gets closed.

This leads to the problem, that all Categories log to closed Appenders at the rest of time.
:-(

Please advise.

Thank you.

Best regards
Christian Hübert

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message