[logback-user] Some questions about DBAppender of the logback

Yun He canalyun at gmail.com
Mon Mar 14 06:35:10 UTC 2016


Hi,everyone,
Following is my logback.xml about implement DBAppender just to storage the
log message to mysql database.
 <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
      <connectionSource
class="ch.qos.logback.core.db.DriverManagerConnectionSource">
          <driverClass>com.mysql.jdbc.Driver</driverClass>
          <url>jdbc:MySQL://127.0.0.1:3306/EventDataBase</url>
          <user>root</user>
          <password>root</password>
      </connectionSource>
  </appender>

then: The following is the result ,the log message was storage in the mysql
database,but the "timestmp" filed in the table named logging_event ,the
timestmp's pattern is not as{HH:mm:ss.SSS} just as the consoleAppender,can
I transform it's pattern to {HH:mm:ss:SSS} ? Could you please give me some
help?I have tried add <encoder> <pattern>%d{HH:mm:ss.SSS} </pattern></encoder>
as the ConsoleAppender's logback.xml,but I failed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20160314/66cdb182/attachment.html>


More information about the logback-user mailing list