CustomSQLDBReceiver allows you to retrieve events from a schema that you've 
defined, where you have to specify the SQL and map your schema columns to 
column names that the receiver expects (what you have below).

Log4j 1.3 provides a DBAppender/DBReceiver pair.  DBAppender/DBReceiver defines 
a set of tables that that logging events are written to and retrieved from.  
You can't modify this table structure if you're using DBAppender/DBReceiver.

You haven't changed your receiver to use CustomSQLDBReceiver.  Your config 
won't work until you change it to use CustomSQLDBReceiver as the plugin's 
'class'.

I don't think I can answer your Oracle questions.  If you can define a query as 
a string that can retrieve data from your schema, Chainsaw can use that string 
as the SQL param.  

To retrieve events from your own schema, you MUST use CustomSQLDBReceiver.  
Also, I don't think you're escaping reserved words correctly in Oracle.

Use this XML config and correct your SQL:

<?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.CustomSQLDBReceiver">
      <connectionSource 
class="org.apache.log4j.db.DriverManagerConnectionSource">
        <param name="driverClass" 
value="oracle.jdbc.driver.OracleDriver"/>
        <param name="password" value="blah"/>
        <param name="user" value="I026526"/>
        <param name="url" value="jdbc:oracle:thin:@blah:1521:brewu"/>
      </connectionSource>
     <param name="IDField" value="log_id"/>
     <param name="refreshMillis" value="3000"/>
     <param name="sql" value="SELECT line as LINE, application as 
APPLICATION, log_level as &quot;LEVEL&quot;, message as MESSAGE, hostname 
as HOSTNAME, src_file as &quot;FILE&quot;, stack as THREAD, log_time as 
TIMESTAMP, '' AS NDC, '' AS MDC, '' AS CLASS, '' AS METHOD, 
CONCAT('{{USERID,'||USER_ID||',log4jid,'||log_id||'}}','') AS PROPERTIES, 
'' AS EXCEPTION, '' AS LOGGER from bu_log"/>
   </plugin>
   <root>
      <level value="debug"/>
   </root>
</log4j:configuration>

Scott

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Sun 9/10/2006 10:02 AM
To: [EMAIL PROTECTED]
Cc: Log4J Users List
Subject: RE: chainsaw with DBReceiver
 
Hi.  Thanks for all your help so far.  I got further and the receiver is 
showing up in chainsaw and it connects.  However, I get an oracle table or 
view does not exist error.  I create a Java class that uses this same 
connection and sql and it works just fine.  Do you have any thoughts on 
why I might be getting the error?

I also have the following questions:
When is it best to use DBReceiver vs CustomDBReceiver?
Can you define custom columns? ie. select ....  , category as category. 
Would I add this custom column in the xml file to get it to show up in 
chainsaw?

Here is my lastest configuration file.  I have also attached the java 
class I created incase it helps at all.



<?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="I026526"/>
        <param name="url" value="jdbc:oracle:thin:@blah:1521:brewu"/>
      </connectionSource>
     <param name="IDField" value="log_id"/>
     <param name="refreshMillis" value="3000"/>
     <param name="sql" value="SELECT line as LINE, application as 
APPLICATION, log_level as &quot;LEVEL&quot;, message as MESSAGE, hostname 
as HOSTNAME, src_file as &quot;FILE&quot;, stack as THREAD, log_time as 
TIMESTAMP, '' AS NDC, '' AS MDC, '' AS CLASS, '' AS METHOD, 
CONCAT('{{USERID,'||USER_ID||',log4jid,'||log_id||'}}','') AS PROPERTIES, 
'' AS EXCEPTION, '' AS LOGGER from bu_log"/>
   </plugin>
   <root>
      <level value="debug"/>
   </root>
</log4j:configuration>






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to