I think this xml (or this with a few tweaks) may work for you..Note, I don't know if you have a column that would make sense as the 'logger' column, so in this example I'm using the string 'logger'. I've added some explanation below the xml.
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <plugin name="MyDBReceiver" class="org.apache.log4j.db.DBReceiver"> <connectionSource class="org.apache.log4j.db.DriverManagerConnectionSource"> <param name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <param name="password" value="blah"/> <param name="user" value="blah"/> <param name="url" value="jdbc:oracle:thin:@blah:1521:blah"/> </connectionSource> <param name="IDField" value="log_id"/> <param name="refreshMillis" value="3000"/> <param name="sql" value="SELECT 'logger' as LOGGER, log_time as TIMESTAMP, log_level as LEVEL, stack as THREAD, message as MESSAGE, '' as NDC, '' as MDC, '' as CLASS, '' as METHOD, src_file as FILE, line as LINE, CONCAT('{{USERID'||USER_ID||',log4jid,'||log_id||'}}') AS PROPERTIES, '' AS EXCEPTION from bu_log"/> </plugin> <root> <level value="debug"/> </root> </log4j:configuration> All columns are required - you're missing the LOGGER column. Also, your 'properties' column is missing the double-braces at each end as well as the comma separation between each name and value. Also, leave out the order by - it breaks the ability to use IDField which is needed to retrieve new events every x milliseconds (the receiver is blindly adding a where clause in order to avoid retrieving the same events twice). You also need an IDField param in the receiver config if you want the query to be ran more than once. Does your table use log_id as the (int) unique identifier? If so, use log_id as your IDField param in the xml and leave it out of the SQL. Your resulting 'properties' column should look like this - note the braces and commas: {{name1,value1,name2,value2}} Run your SQL in a query analyzer and make sure you have each required column, and that the properties column looks correct. It takes a bit of work to get set up, but it works! Good luck! Scott SELECT log_id as ID, line as LINE, application as APPLICATION, log_level as LEVEL, message as MESSAGE, hostname as HOSTNAME, src_file as FILE, stack as THREAD, log_time as TIMESTAMP, '' AS NDC, '' AS MDC, '' AS CLASS, '' AS METHOD, CONCAT(USER_ID||' '||CATEGORY||' '||log4jid) AS PROPERTIES, '' AS EXCEPTION from bu_log order by TIMESTAMP desc, APPLICATION" select logger as LOGGER, timestamp as TIMESTAMP, level as LEVEL, thread as THREAD, message as MESSAGE, ndc as NDC, mdc as MDC, class as CLASS, method as METHOD, file as FILE, line as LINE, concat("{{application,databaselogs,hostname,mymachine, log4jid,", COUNTER,"}}") as PROPERTIES, "" as EXCEPTION from logtable So in your case, I'd modify your sql to look like this: 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thu 9/7/2006 2:26 PM To: [email protected] Subject: chainsaw with DBReceiver Hi, I am trying to using chainsaw to monitor logs that we insert into our database (oracle db). I created the file below and launched chainsaw. I manually pointed chainsaw to this config file. The receiver shows up; however, nothing happens. I get no errors and I get no tab for the receiver. I did notice that the refreshMillis is different in the properties in the chainsaw gui than in the file below. In addition, the connectionSource is blank. Can you give me an idea of what I am doing wrong? In addition, the sql below has issues in oracle because level is a key word in oracle. Does DBReceiver require the field be aliased as LEVEL? If so, how would I get around the key word issue. Also, is there a way that upon start up, this receiver would get loaded automatically? Thanks. <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <plugin name="MyDBReceiver" class="org.apache.log4j.db.DBReceiver"> <connectionSource class="org.apache.log4j.db.DriverManagerConnectionSource"> <param name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <param name="password" value="blah"/> <param name="user" value="blah"/> <param name="url" value="jdbc:oracle:thin:@blah:1521:blah"/> </connectionSource> <param name="refreshMillis" value="3000"/> <param name="sql" value="SELECT log_id as ID, line as LINE, application as APPLICATION, log_level as LEVEL, message as MESSAGE, hostname as HOSTNAME, src_file as FILE, stack as THREAD, log_time as TIMESTAMP, '' AS NDC, '' AS MDC, '' AS CLASS, '' AS METHOD, CONCAT(USER_ID||' '||CATEGORY||' '||log4jid) AS PROPERTIES, '' AS EXCEPTION from bu_log order by TIMESTAMP desc, APPLICATION"/> </plugin> <root> <level value="debug"/> </root> </log4j:configuration>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
