[logback-user] Logback logging to MySQL

Stephen Schaeffer Stephen.Schaeffer at theice.com
Fri Jun 3 23:09:20 CEST 2011


Hi Simon,

Thanks for the response.

Based on your response and further digging through the docs (http://logback.qos.ch/manual/appenders.html), it seems there are two 'flavors' of DBAccess, one through Logback Classic, the other through Logback Access, and that they have different DB setups.

Classic has three tables, logging_event, logging_event_property, and logging_event_exception, while the Access version has the tables which are set up by the mysql.sql script file included in logback-access/src/main/java/ch/qos/logback/access/db/dialect/.

Having said all that, I created what I though were the proper tables and fields for the Classic version, and it's still not working for me so I'm still missing something.

Steph


On Jun 3, 2011, at 2:07 PM, Simon Gaeremynck wrote:

I've noticed this behaviour as well and asked about it on this list [1].
But it went passed unnoticed.

It seems that the mysql.sql file has the same missing column names.
When I added those column names, everything ran perfectly.

Regards,

Simon


[1] http://markmail.org/message/eqlyxeqjtd7jogsj

On 3 Jun 2011, at 20:00, Stephen Schaeffer wrote:

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.
_______________________________________________
Logback-user mailing list
Logback-user at qos.ch<mailto:Logback-user at qos.ch>
http://qos.ch/mailman/listinfo/logback-user

<ATT00001..txt>

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/6d232652/attachment-0001.html>


More information about the Logback-user mailing list