Issue Type: Bug Bug
Affects Versions: 1.1.2
Assignee: Logback dev list
Components: logback-classic
Created: 07/Oct/14 10:55 PM
Description:

We have configured DBAppender to log to a SQL Server database from a Spring webapp under Tomcat using ch.qos.logback.core.db.DataSourceConnectionSource. This works fine, except that when the host reboots (this is Windows, after all), Tomcat restarts faster than SQL Server does, so when DataSourceConnectionSource is first started, it fails to connect to the database.

There should be a way to detect this and retry the connection., Alternately, there should be a way for the application to check DBAppender's state and tell it to reconnect if needed.

12:11:11,593 |-WARN in ch.qos.logback.core.db.DataSourceConnectionSource@134c00a9 - Could not discover the dialect to use. java.sql.SQLException: Cannot open database requested by the login. The login failed.
at java.sql.SQLException: Cannot open database requested by the login. The login failed.
at at ch.qos.logback.core.db.DataSourceConnectionSource.getConnection(DataSourceConnectionSource.java:63)
at at ch.qos.logback.core.db.ConnectionSourceBase.discoverConnectionProperties(ConnectionSourceBase.java:48)
at at ch.qos.logback.core.db.DataSourceConnectionSource.start(DataSourceConnectionSource.java:44)
at at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167)
at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129)
at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302)
at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276)
at at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
at at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:274)
at at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:282)

Environment:

logback 1.1.2 with slf4j 1.7.7, using DBAppender to log to a SQL Server database from a Spring webapp under Tomcat via ch.qos.logback.core.db.DataSourceConnectionSource

Project: logback
Labels: dbappender
Priority: Major Major
Reporter: Paul Krause
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-dev

Reply via email to