logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oswaldo Caballero <osw...@gmail.com>
Subject Log4j2 databaseAppender does not write to the database. It was working before!
Date Fri, 06 Dec 2013 15:45:29 GMT

First of all, sorry if I'm posting to the wrong list. If that's the 
case, I'll be grateful if someone redirects me to the correct list.

Well, my problem is with the databaseAppender in log4j2 beta 8. It was 
working OK two weeks ago but now it does not write to the log table. I 
must say that I'm using a pretty standard XML configuration file where I 
have a  FastRollingFile (which works perfectly)  and the 
databaseAppender. The file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="trace">
         <Console name="Console" target="SYSTEM_OUT">
             <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level 
%logger{36} - %msg%n"/>
         <FastRollingFile name="FastRollingFile" 
             <PatternLayout pattern="%d [%t] %-5level %logger{36} - %L 
%M - %msg%n"/>
                 <SizeBasedTriggeringPolicy size="50 MB"/>
             <DefaultRolloverStrategy max="20"/>
         <JDBC name="databaseAppender" tableName="harvester.logs">
             <Column name="Date" isEventTimestamp="true"/>
             <Column name="Level" pattern="%level"/>
             <Column name="Logger" pattern="%logger"/>
             <Column name="Description" pattern="%message"/>
             <Column name="Exception" pattern="%ex{full}"/>
         <logger name="ca.umontreal.cenr.quinoa.harvester" level="trace">
             <appender-ref ref="FastRollingFile"/>
         <root level="trace">
             <appender-ref ref="databaseAppender"/>

The log4j2 logger does not report any error and the databaseAppender is 
correctly initialized.

I've read many times the Configuration and Appenders sections on the 
online guide and I've tried to change the way the database connection is 
obtained by replacing the <ConnectionFactory> tag with a <DriverManager> 

<DriverManager url="jdbc:mysql://localhost:3306/harvester" 
username="root" password="***" />

without success.

I've also interchanged the assigned appender on the loggers section:

         <logger name="ca.umontreal.cenr.quinoa.harvester" level="trace">
             <appender-ref ref="databaseAppender"/>
         <root level="trace">
             <appender-ref ref="FastRollingFile"/>

and the FastRollingFile appender continues to work without a problem, 
but the databaseAppender do not.

I must say finally that the application writes to the database without 
problems and that the database configuration has not being modified in 
any way.

May be I'm overlooking something obvious but right now I do not know 
what's wrong.

Thanks and sorry for the long post.

Best regards,


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

View raw message