
Hi all, I'm attempting to use the DBAppender, with the MySQL dialect. I am unable to actually put any records into my DB however. It seems that the culprit is that in DBAppenderBase:append, there is a call to subAppend, which is implemented either in Access, in which case it takes an AccessEvent as it's first argument, or in Classic, in which case it takes an ILoggingEvent as it's first argument. What it is actually passing is a LoggingEvent (no initial I) object, and so I'm getting ClassCastExceptions, and nothing in my DB. I'm assuming that someone out there has this working, and I'm just wondering what I'm doing wrong. Thanks for any help. 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.

Hello Stephen, LoggingEvent is an instance of ILoggingEvent so you should not get class cast exceptions. Could you send the stack trace? -- Ceki On 06/06/2011 10:50 PM, Stephen Schaeffer wrote:
Hi all,
I'm attempting to use the DBAppender, with the MySQL dialect.
I am unable to actually put any records into my DB however. It seems that the culprit is that in DBAppenderBase:append, there is a call to subAppend, which is implemented either in Access, in which case it takes an AccessEvent as it's first argument, or in Classic, in which case it takes an ILoggingEvent as it's first argument. What it is actually passing is a LoggingEvent (no initial I) object, and so I'm getting ClassCastExceptions, and nothing in my DB.
I'm assuming that someone out there has this working, and I'm just wondering what I'm doing wrong.
Thanks for any help.
*Stephen Schaeffer*

java.lang.ClassCastException: ch.qos.logback.classic.spi.LoggingEvent cannot be cast to ch.qos.logback.access.spi.AccessEvent at ch.qos.logback.access.db.DBAppender.subAppend(DBAppender.java:36) at ch.qos.logback.core.db.DBAppenderBase.append(DBAppenderBase.java:107) at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:88) at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:64) at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:285) at ch.qos.logback.classic.Logger.callAppenders(Logger.java:272) at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:473) at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:427) at ch.qos.logback.classic.Logger.info(Logger.java:631) Steph On Jun 6, 2011, at 5:18 PM, Ceki Gülcü wrote: Hello Stephen, LoggingEvent is an instance of ILoggingEvent so you should not get class cast exceptions. Could you send the stack trace? -- Ceki On 06/06/2011 10:50 PM, Stephen Schaeffer wrote: Hi all, I'm attempting to use the DBAppender, with the MySQL dialect. I am unable to actually put any records into my DB however. It seems that the culprit is that in DBAppenderBase:append, there is a call to subAppend, which is implemented either in Access, in which case it takes an AccessEvent as it's first argument, or in Classic, in which case it takes an ILoggingEvent as it's first argument. What it is actually passing is a LoggingEvent (no initial I) object, and so I'm getting ClassCastExceptions, and nothing in my DB. I'm assuming that someone out there has this working, and I'm just wondering what I'm doing wrong. Thanks for any help. *Stephen Schaeffer* _______________________________________________ Logback-user mailing list Logback-user@qos.ch<mailto:Logback-user@qos.ch> http://qos.ch/mailman/listinfo/logback-user Stephen Schaeffer IntercontinentalExchange | ICE 2100 RiverEdge Pkwy | 5th Floor | Atlanta, GA 30328 Tel: 203.599.1881 stephen.schaeffer@theice.com<mailto:stephen.schaeffer@theice.com> 24-hour ice helpdesk 770.738.2101 http://www.theice.com/ ________________________________ 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.

On 06/06/2011 11:26 PM, Stephen Schaeffer wrote:
java.lang.ClassCastException: ch.qos.logback.classic.spi.LoggingEvent cannot be cast to ch.qos.logback.access.spi.AccessEvent at ch.qos.logback.access.db.DBAppender.subAppend(DBAppender.java:36) at ch.qos.logback.core.db.DBAppenderBase.append(DBAppenderBase.java:107) at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:88) at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:64) at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:285) at ch.qos.logback.classic.Logger.callAppenders(Logger.java:272) at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:473) at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:427) at ch.qos.logback.classic.Logger.info(Logger.java:631)
Steph
On Jun 6, 2011, at 5:18 PM, Ceki Gülcü wrote:
Thanks. Could you provide your configuration file as well? -- Ceki

<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/logback_db</url> <user>logback</user> <password>logback</password> </connectionSource> </appender> On Jun 6, 2011, at 5:29 PM, Ceki Gülcü wrote: On 06/06/2011 11:26 PM, Stephen Schaeffer wrote: java.lang.ClassCastException: ch.qos.logback.classic.spi.LoggingEvent cannot be cast to ch.qos.logback.access.spi.AccessEvent at ch.qos.logback.access.db.DBAppender.subAppend(DBAppender.java:36) at ch.qos.logback.core.db.DBAppenderBase.append(DBAppenderBase.java:107) at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:88) at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:64) at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:285) at ch.qos.logback.classic.Logger.callAppenders(Logger.java:272) at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:473) at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:427) at ch.qos.logback.classic.Logger.info(Logger.java:631) Steph On Jun 6, 2011, at 5:18 PM, Ceki Gülcü wrote: Thanks. Could you provide your configuration file as well? -- Ceki _______________________________________________ Logback-user mailing list Logback-user@qos.ch<mailto:Logback-user@qos.ch> http://qos.ch/mailman/listinfo/logback-user Stephen Schaeffer IntercontinentalExchange | ICE 2100 RiverEdge Pkwy | 5th Floor | Atlanta, GA 30328 Tel: 203.599.1881 stephen.schaeffer@theice.com<mailto:stephen.schaeffer@theice.com> 24-hour ice helpdesk 770.738.2101 http://www.theice.com/ ________________________________ 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.

Hi Stephen, You should use the DBAppender located in logback-classic. The fully qualified class name is ch.qos.logback.classic.db.DBAppender. The DBAppender you are using is from logback-access which does HTTP access-logging. See also http://logback.qos.ch/manual/appenders.html#DBAppender HTH -- Ceki On 06/06/2011 11:36 PM, Stephen Schaeffer wrote:
<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/logback_db</url> <user>logback</user> <password>logback</password> </connectionSource> </appender>
On Jun 6, 2011, at 5:29 PM, Ceki Gülcü wrote:
On 06/06/2011 11:26 PM, Stephen Schaeffer wrote:
java.lang.ClassCastException: ch.qos.logback.classic.spi.LoggingEvent cannot be cast to ch.qos.logback.access.spi.AccessEvent at ch.qos.logback.access.db.DBAppender.subAppend(DBAppender.java:36) at ch.qos.logback.core.db.DBAppenderBase.append(DBAppenderBase.java:107) at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:88) at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:64) at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:285) at ch.qos.logback.classic.Logger.callAppenders(Logger.java:272) at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:473) at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:427) at ch.qos.logback.classic.Logger.info(Logger.java:631)
Steph
On Jun 6, 2011, at 5:18 PM, Ceki Gülcü wrote:
Thanks. Could you provide your configuration file as well? -- Ceki _______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch> http://qos.ch/mailman/listinfo/logback-user
*Stephen Schaeffer* IntercontinentalExchange | ICE 2100 RiverEdge Pkwy | 5th Floor | Atlanta, GA 30328 Tel: 203.599.1881 stephen.schaeffer@theice.com <mailto:stephen.schaeffer@theice.com>
participants (2)
-
Ceki Gülcü
-
Stephen Schaeffer