logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harper, Allen \(AHARPER\)" <AHAR...@arinc.com>
Subject FallbackErrorHandler hangs up thread
Date Wed, 02 Mar 2005 14:56:15 GMT
 
I have added the FallbackErrorHandler in my XML config for failover if
the JDBC appender fails.

The JDBC appender is under control of the ASYNC appender.

In my test I deliberately shutdown MySQL to cause DB access failure.
FallbackErrorHandler does pick up on the failure and attempts to switch
over. Unfortunately in the error routine when the following line is
called the thread locks indefinitely. I can't seem to even step into it.

l.removeAppender(primary);

Has anyone else run into this problem? Below is my XML config for
review. I urgently need this resolved and would appreciate any help.

Thanks Al Harper


<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
	<!-- =================Appenders for CSF=================-->
	<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
		<param name="BufferSize" value="1"/>
		<appender-ref ref="CSF_JDBC"/>
	</appender>
	
	<appender name="CSF_FILE"
class="org.apache.log4j.RollingFileAppender">
		<param name="Threshold" value="DEBUG"/>
		<param name="File"
value="C:/selfserv/logs/platformimpl.html"/>
		<param name="Append" value="true"/>
		<param name="MaxFileSize" value="500KB"/>
		<param name="MaxBackupIndex" value="1"/>
		<layout class="org.apache.log4j.HTMLLayout"/>
	</appender>
	
	<!--JDBC-->
	<appender name="CSF_JDBC"
class="org.apache.log4j.jdbc.JDBCAppender">
         <errorHandler
class="org.apache.log4j.varia.FallbackErrorHandler">
 	    <logger-ref ref="PlatformImpl"/>
 	    <appender-ref ref="CSF_FILE"/>
	  </errorHandler>
		<param name="BufferSize" value="1"/>
		<param name="Threshold" value="DEBUG"/>
		<param name="driver" value="com.mysql.jdbc.Driver"/>
		<param name="URL"
value="jdbc:mysql://localhost:3306/logtest?autoReconnect=true"/>
		<param name="user" value="aharper"/>
		<param name="password" value="aharper"/>
		<param name="sql" value="insert into %X{table} (id,
cor_key, date, fileName, lineNumber, message) values (0, '%X{key}',
'%d', '%F', '%L', '%m')"/>
	</appender>
	
	<appender name="CONSOLE"
class="org.apache.log4j.ConsoleAppender">
		<param name="Target" value="System.out"/>
		<param name="Threshold" value="DEBUG"/>
		<layout class="org.apache.log4j.PatternLayout">
			<param name="ConversionPattern" value="%d, %F,
%L, %m%n"/>
		</layout>
	</appender>
	
	<logger name="PlatformImpl">
		<level value="DEBUG"/>
		<appender-ref ref="ASYNC"/>
<!--		<appender-ref ref="CSF_FILE"/>   -->
		<appender-ref ref="CONSOLE"/>
	</logger>
	<!--
	<root>
		<level value="DEBUG"/>
		<appender-ref ref="ASYNC"/>
		<appender-ref ref="CSF_FILE"/>
		<appender-ref ref="CONSOLE"/>
	</root>
-->
</log4j:configuration>

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


Mime
View raw message