I created a table with the following statement.
1) CREATE TABLE `userdb`.`sys_log` ( `log_id` int(10) unsigned NOT NULL auto_increment, `log_date` timestamp NOT NULL default CURRENT_TIMESTAMP, `sys_name` varchar(45) NOT NULL, `machine_name` varchar(45) NOT NULL, `class_name` varchar(45) NOT NULL, `priority` varchar(45) NOT NULL, `message` varchar(45) default NULL, `extended_message` varchar(45) default NULL, `user_id` int(10) unsigned NOT NULL, `method_name` varchar(45) NOT NULL, PRIMARY KEY (`log_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; My config file is like this... 2) <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true"> <appender name="A2" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.SimpleLayout"/> </appender> <plugin name="CustomDBReceiver" class="org.apache.log4j.db.CustomSQLDBReceiver"> <connectionSource class="org.apache.log4j.db.DriverManagerConnectionSource"> <param name="password" value="admin"/> <param name="user" value="root"/> <param name="driverClass" value="org.gjt.mm.mysql.Driver"/> <param name="url" value="jdbc:mysql://127.0.0.1/user_db"/> </connectionSource> <param name="refreshMillis" value="5000"/> <param name="sql" value='select logger as LOGGER, log_date as TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS, method_name as METHOD, concat("{{application,databaselogs,hostname,mymachine,log4jid,", COUNTER, "}}") as PROPERTIES, "" as EXCEPTION from sys_log'/> THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE <param name="IDField" value="log_id"/> </plugin> <root> <level value="debug"/> </root> </log4j:configuration> I also setup automatic configuration script to point to my config file in chainsaw. But when I open chainsaw, nothing happens. I have also put the MySQL driver .jar file in .chainsaw/plugins directory. Please let me know what I am missing. Regards, Varun Rally --------------------------------------------------- Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301 Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800 VOIP - 434-509-0698 Extn. 121 US Phone- 001-303-293-2223 Extn. 22814 -----Original Message----- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 10:29 AM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/ log4j/db/CustomSQLDBReceiver.html Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update your chainsaw xml config file to use the receiver (see the Welcome tab - there's a 'view example receiver configuration' button on that tab which contains an example configuration file. The receiver essentially requires you to define aliases from your columns to fixed columns the receiver is going to use to run the query. It also supports an IDField param, which is assumed to be an auto-incrementing int, which will allow you to 'tail' the events from the database when running the query multiple times (if the refreshMillis param is defined). Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax: 503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -----Original Message----- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 9:12 AM To: [email protected] Subject: Question for CustomSQLDBReceiver Hello All, I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have got an idea of what it is, I am not able to get it running. Please provide me an internet link or URL that explains the steps to use a CustomSQLDBReceiver. Thanks in anticipation. Regards, Varun
