public class BatchFileLogger extends FileLogger
modify the spy.properties file to make p6spy use this appender by setting appender=com.p6spy.engine.spy.appender.BatchFileLogger.
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 :)
| Modifier and Type | Field and Description |
|---|---|
static char |
BATCH_SEPARATOR |
strategy| Constructor and Description |
|---|
BatchFileLogger() |
| Modifier and Type | Method and Description |
|---|---|
void |
logException(java.lang.Exception e)
Logs the stacktrace of the exception.
|
void |
logSQL(int connectionId,
java.lang.String now,
long elapsed,
Category category,
java.lang.String prepared,
java.lang.String sql,
java.lang.String url)
Logs the
SQL. |
void |
logText(java.lang.String text)
Logs the text.
|
getStream, setLogfileisCategoryEnabledsetStrategypublic static final char BATCH_SEPARATOR
public void logException(java.lang.Exception e)
P6LoggerlogException in interface P6LoggerlogException in class StdoutLoggere - exception holding the stacktrace to be logged.public void logSQL(int connectionId,
java.lang.String now,
long elapsed,
Category category,
java.lang.String prepared,
java.lang.String sql,
java.lang.String url)
P6LoggerSQL.logSQL in interface P6LoggerlogSQL in class FormattedLoggerconnectionId - connection identifier.now - current time.category - the category to be used for logging.prepared - the prepared statement to be logged.sql - the SQL to be logged.url - the database url where the sql statement executedpublic void logText(java.lang.String text)
P6LoggerlogText in interface P6LoggerlogText in class StdoutLoggertext - to be logged