grace.log
Class JDBCHandler

java.lang.Object
  |
  +--grace.log.JDBCHandler

public class JDBCHandler
extends java.lang.Object
implements Handler

This handles events by writing them to a JDBC database. The following properties are used:

Properties:

     log.handler.name.url = jdbc:idb:idb.prp
     log.handler.name.table = Log
     log.handler.name.format =
         "'%t', %n, '%e', '%h', '%c', '%f', '%l', '%m', '%(%j)o'"
     log.handler.name.username = ""
     log.handler.name.password = ""
     log.handler.name.columns = "(t, number, type, ...)"
 

This handler assumes that the database and table are already created on the target database. Using the default column and format, this handler will write entry using the following SQL:

 insert into Log values ('12/31/99 23:59:59', 1001,
 'error', 'thread-1', 'MyClass', 'myFunc', '129', 'problem with
 something', 'String s = "a string"'); 

In other words this writes the log entry without assuming the name of the columns in the database but it assumes the order and type. Of course this can be changed by simple specifying the '.table', '.columns', and/or '.format' properties.

Here is the schema that was used to test this Handler using the postgres database.

 	CREATE TABLE Log (
		eventtime   datetime,
  		number      int,
		type        varchar(32),
  		thread      varchar(64),
  		class       varchar(64),
  		function    varchar(64),
  		line        varchar(8),
  		message     varchar(256),
  		object      varchar(256));
 

But notice that using the default properties, the column names don't really matter - just the order in which they appear in the schema.

Properties:


Constructor Summary
JDBCHandler(java.lang.String prefix, java.lang.String name)
           
 
Method Summary
 void handle(Event event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCHandler

public JDBCHandler(java.lang.String prefix,
                   java.lang.String name)
            throws java.rmi.RemoteException
Method Detail

handle

public void handle(Event event)
Specified by:
handle in interface Handler