#4 SQL batch file logger

closed-accepted
nobody
None
5
2009-03-14
2006-06-27
Kosta
No

Appender that writes a trace of JDBC activity into an
SQL batch file that can be later "replayed" using a
generic SQL client.

Usage:

- compile BatchFileLogger.java with p6spy.jar in
classpath or copy it into
com/p6spy/engine/logging/appender subdirectory of the
project's source and make the project

- modify the spy.properties file to make p6spy use
this appender by adding line

appender=com.p6spy.engine.logging.appender.BatchFileLo
gger

and commenting out the existing appender

#appender=com.p6spy.engine.logging.appender.FileLogger

- specify an alternative log file name in
spy.properties so that diagnostic entries to spy.log
made by p6spy at startup do not mess up your batch.
Here's how it works for me:

logfile = spy.sql

The appender writes the text of SQL statements as
well as commit and rollback commands to the specified
file, each on a new line. For prepared statements the
effective text resulting from substitution of
parameter signs with their values is written. Other
event categories are logged as SQL comments ("-- "
followed by the category name). Exceptions and text
are silently discarded. All SQL statements except the
last one will have a delimiter character ';' appended
to them.

This batch format works well with WinSQL. The format
is hardcoded, so if you want to make it configurable
you'll have to patch my patch or write your own :)

Enjoy!

Discussion

  • Kosta

    Kosta - 2006-06-29
     
    Attachments
  • Pat

    Pat - 2009-03-13

    added to svn repo

     
  • Pat

    Pat - 2009-03-14
    • status: open --> closed-accepted
     
  • Pat

    Pat - 2009-03-14

    in svn repo, althoug may go away as i think slf4j or others have this ability. ( + not very config ) but its there for now!

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks