Hi,
One of our MAVEN project is using Logback and it is having
requirement to store the log content into MySQL db (version 5.0). Below are my
Logback configuration and the output for the same.
CONFIGURATION
<configuration
debug="false">
<appender
name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<layout
class="ch.qos.logback.classic.PatternLayout">
<pattern>[%level] %X{module} %msg%n</pattern>
</layout>
</appender>
<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://localhost:3306/logback_db</url>
<user>root</user>
<password>mypassword</password>
<insertHeaders>true</insertHeaders>
</connectionSource>
</appender>
<root>
<level value="${ROOT_LOGGER_LEVEL}"/>
<appender-ref
ref="DB" />
</root>
<root>
<level
value="${ROOT_LOGGER_LEVEL}"/>
<appender-ref
ref="STDOUT"/>
</root>
</configuration>
OUTPUT IN THE
CONSOLE
For correct
db parameters
[INFO]
[app-core:internal]
Driver
name=MySQL-AB JDBC Driver
Driver
version=mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} )
supportsGetGeneratedKeys=true
true
For wrong db parameters
[INFO]
[app-core:internal] false
The above configuration is not creating any db tables and
not able to store the content. Please let me know the necessary changes to
these configurations.
Thanks in advance…
--
Thanks and
Regards
Shivashankar
iGATE is Ranked No. 1 in DQ-IDC best IT employer survey and Ranked No.2 by Business Today-Mercer Human Resource Consulting-TNS in a cross industry survey of Best Companies to work for in India ----------------------------------------------------------------DISCLAIMER--------------------------------------------------------- Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@igate.com and delete this EMAIL including any attachments |