I want to use log4j viewer (Chainsaw) to read error logs logged in a MySql database by log4j. I am a bit struggling as the documentation is really sparse.
[strike]Here is my tentative .xml config for Chainsaw:[/strike]
Here is my new .xml config:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<plugin name="CustomDBReceiver" class="org.apache.log4j.db.CustomSQLDBReceiver">
<connectionSource class="org.apache.log4j.db.DriverManagerConnectionSource">
<param name="password" value="my_pwd"/>
<param name="user" value="my_uid"/>
<param name="driverClass" value="org.gjt.mm.mysql.Driver"/>
<param name="url" value="jdbc:mysql://<my_host>:<my_host_port>/<my_database>"/>
</connectionSource>
<param name="refreshMillis" value="1000"/>
<param name="sql" value='select ID as ID, Logger as LOGGER, Date as TIMESTAMP, Level as LEVEL, Thread as THREAD, Message as MESSAGE, Exception as EXCEPTION, DestID as DESTID, IPAddress as IP, Stacktrace as STACKTRACE from errorlogs'/>
<param name="IDField" value="ID"/>
</plugin>
<root>
<level value="debug"/>
</root>
</log4j:configuration>
It tells me that:
No suitable driver found for jdbc:mysql://<my_host>:<my_host_port>/<my_database>
I have downloaded the DBReceiver extension (log4j-db-1.3alpha-7) and put it in my .chainsaw/plugins directory. I also put “mysql-connector-java-5.1.16-bin” in the .chainsaw directory just to be sure, since it seemed like it was the cause of the problem. However, it did not fix it.
Does any of you guys have know how to connect Chainsaw to a MySql database?
Thanks!
And more info on how to use jars that aren’t distributed with Chainsaw:
http://logging.apache.org/chainsaw/distributionnotes.html
By the way, you may want to try the latest developer snapshot of Chainsaw, available here:
http://people.apache.org/~sdeboy
Lots of new features…
Scott