Hi,

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">
    <appenders>
        <Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
<FastRollingFile name="FastRollingFile" fileName="/home/oswcab/workspace/harvester/logs/harvester.log"
filePattern="logs/$${date:yyyy-MM}/harvester-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="%d [%t] %-5level %logger{36} - %L %M - %msg%n"/>
            <Policies>
                <TimeBasedTriggeringPolicy/>
                <SizeBasedTriggeringPolicy size="50 MB"/>
            </Policies>
            <DefaultRolloverStrategy max="20"/>
        </FastRollingFile>
        <JDBC name="databaseAppender" tableName="harvester.logs">
<ConnectionFactory class="ca.umontreal.cenr.quinoa.harvester.DataConnection" method="getConnection"/>
            <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}"/>
        </JDBC>
    </appenders>
    <loggers>
        <logger name="ca.umontreal.cenr.quinoa.harvester" level="trace">
            <appender-ref ref="FastRollingFile"/>
        </logger>
        <root level="trace">
            <appender-ref ref="databaseAppender"/>
        </root>
    </loggers>
</configuration>

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> tag:

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

without success.

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

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

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,

Oswaldo




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to