logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: Log4j2 databaseAppender does not write to the database. It was working before!
Date Fri, 06 Dec 2013 15:51:32 GMT
Can you try with the current version please, beta 9?

Gary


On Fri, Dec 6, 2013 at 10:45 AM, Oswaldo Caballero <oswcab@gmail.com> wrote:

> 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: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

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