[logback-user] Logback logging to MySQL

Stephen Schaeffer Stephen.Schaeffer at theice.com
Fri Jun 3 20:00:14 CEST 2011


Hi all,

I am in the process of exploring logback so we can migrate our logging off of our current mishmash. As part of that I have been trying to configure to write to a MySQL database.

In the configuration file I have this:

  <appender name="DB" class="ch.qos.logback.access.db.DBAppender">
    <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
      <driverClass>com.mysql.jdbc.Driver</driverClass>
      <url>jdbc:mysql://localhost:3306/test</url>
      <user>logback</user>
      <password>logback</password>
    </connectionSource>
    <insertHeaders>true</insertHeaders>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="FILE" />
    <appender-ref ref="DB" />
  </root>

And I've run the scripts to set up the tables in MySQL, and logback can apparently connect ok - if I change any of the parameters in the config I get errors about it not connecting.

On the console and in the logfile I can see output as I would expect, but the DB remains empty. I'm using MySQL 5.1.51 on a Mac, for what that's worth.


Stephen Schaeffer

________________________________
This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20110603/82bbd07c/attachment.html>


More information about the Logback-user mailing list