Package org.h2.message
Class Trace
- java.lang.Object
-
- org.h2.message.Trace
-
public final class Trace extends java.lang.ObjectThis class represents a trace module.
-
-
Field Summary
Fields Modifier and Type Field Description static intCOMMANDThe trace module id for commands.static intCONSTRAINTThe trace module id for constraints.static intDATABASEThe trace module id for databases.static intFILE_LOCKThe trace module id for file locks.static intFUNCTIONThe trace module id for functions.static intINDEXThe trace module id for indexes.static intJDBCThe trace module id for the JDBC API.static intJDBCXThe trace module id for the JDBCX APIprivate java.lang.StringlineSeparatorstatic intLOCKThe trace module id for locks.private java.lang.Stringmodulestatic java.lang.String[]MODULE_NAMESModule names by their ids as array indexes.static intSCHEMAThe trace module id for schemas.static intSEQUENCEThe trace module id for sequences.static intSETTINGThe trace module id for settings.static intTABLEThe trace module id for tables.private inttraceLevelprivate TraceWritertraceWriterstatic intTRIGGERThe trace module id for triggers.static intUSERThe trace module id for users.
-
Constructor Summary
Constructors Constructor Description Trace(TraceWriter traceWriter, int moduleId)Trace(TraceWriter traceWriter, java.lang.String module)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(java.lang.String s)Write a message with trace level DEBUG to the trace system.voiddebug(java.lang.String s, java.lang.Object... params)Write a message with trace level DEBUG to the trace system.voiddebug(java.lang.Throwable t, java.lang.String s)Write a message with trace level DEBUG to the trace system.(package private) voiddebugCode(java.lang.String java)Write Java source code with trace level DEBUG to the trace system.voiderror(java.lang.Throwable t, java.lang.String s)Write a message with trace level ERROR to the trace system.voiderror(java.lang.Throwable t, java.lang.String s, java.lang.Object... params)Write a message with trace level ERROR to the trace system.static java.lang.StringformatParams(java.util.ArrayList<? extends ParameterInterface> parameters)Format the parameter list.voidinfo(java.lang.String s)Write a message with trace level INFO to the trace system.voidinfo(java.lang.String s, java.lang.Object... params)Write a message with trace level INFO to the trace system.(package private) voidinfo(java.lang.Throwable t, java.lang.String s)Write a message with trace level INFO to the trace system.voidinfoCode(java.lang.String java)Write Java source code with trace level INFO to the trace system.voidinfoSQL(java.lang.String sql, java.lang.String params, long count, long time)Write a SQL statement with trace level INFO to the trace system.booleanisDebugEnabled()Check if the trace level is equal or higher than DEBUG.private booleanisEnabled(int level)booleanisInfoEnabled()Check if the trace level is equal or higher than INFO.voidsetLevel(int level)Set the trace level of this component.
-
-
-
Field Detail
-
COMMAND
public static final int COMMAND
The trace module id for commands.- See Also:
- Constant Field Values
-
CONSTRAINT
public static final int CONSTRAINT
The trace module id for constraints.- See Also:
- Constant Field Values
-
DATABASE
public static final int DATABASE
The trace module id for databases.- See Also:
- Constant Field Values
-
FUNCTION
public static final int FUNCTION
The trace module id for functions.- See Also:
- Constant Field Values
-
FILE_LOCK
public static final int FILE_LOCK
The trace module id for file locks.- See Also:
- Constant Field Values
-
INDEX
public static final int INDEX
The trace module id for indexes.- See Also:
- Constant Field Values
-
JDBC
public static final int JDBC
The trace module id for the JDBC API.- See Also:
- Constant Field Values
-
LOCK
public static final int LOCK
The trace module id for locks.- See Also:
- Constant Field Values
-
SCHEMA
public static final int SCHEMA
The trace module id for schemas.- See Also:
- Constant Field Values
-
SEQUENCE
public static final int SEQUENCE
The trace module id for sequences.- See Also:
- Constant Field Values
-
SETTING
public static final int SETTING
The trace module id for settings.- See Also:
- Constant Field Values
-
TABLE
public static final int TABLE
The trace module id for tables.- See Also:
- Constant Field Values
-
TRIGGER
public static final int TRIGGER
The trace module id for triggers.- See Also:
- Constant Field Values
-
USER
public static final int USER
The trace module id for users.- See Also:
- Constant Field Values
-
JDBCX
public static final int JDBCX
The trace module id for the JDBCX API- See Also:
- Constant Field Values
-
MODULE_NAMES
public static final java.lang.String[] MODULE_NAMES
Module names by their ids as array indexes.
-
traceWriter
private final TraceWriter traceWriter
-
module
private final java.lang.String module
-
lineSeparator
private final java.lang.String lineSeparator
-
traceLevel
private int traceLevel
-
-
Constructor Detail
-
Trace
Trace(TraceWriter traceWriter, int moduleId)
-
Trace
Trace(TraceWriter traceWriter, java.lang.String module)
-
-
Method Detail
-
setLevel
public void setLevel(int level)
Set the trace level of this component. This setting overrides the parent trace level.- Parameters:
level- the new level
-
isEnabled
private boolean isEnabled(int level)
-
isInfoEnabled
public boolean isInfoEnabled()
Check if the trace level is equal or higher than INFO.- Returns:
- true if it is
-
isDebugEnabled
public boolean isDebugEnabled()
Check if the trace level is equal or higher than DEBUG.- Returns:
- true if it is
-
error
public void error(java.lang.Throwable t, java.lang.String s)Write a message with trace level ERROR to the trace system.- Parameters:
t- the exceptions- the message
-
error
public void error(java.lang.Throwable t, java.lang.String s, java.lang.Object... params)Write a message with trace level ERROR to the trace system.- Parameters:
t- the exceptions- the messageparams- the parameters
-
info
public void info(java.lang.String s)
Write a message with trace level INFO to the trace system.- Parameters:
s- the message
-
info
public void info(java.lang.String s, java.lang.Object... params)Write a message with trace level INFO to the trace system.- Parameters:
s- the messageparams- the parameters
-
info
void info(java.lang.Throwable t, java.lang.String s)Write a message with trace level INFO to the trace system.- Parameters:
t- the exceptions- the message
-
formatParams
public static java.lang.String formatParams(java.util.ArrayList<? extends ParameterInterface> parameters)
Format the parameter list.- Parameters:
parameters- the parameter list- Returns:
- the formatted text
-
infoSQL
public void infoSQL(java.lang.String sql, java.lang.String params, long count, long time)Write a SQL statement with trace level INFO to the trace system.- Parameters:
sql- the SQL statementparams- the parameters used, in the for {1:...}count- the update counttime- the time it took to run the statement in ms
-
debug
public void debug(java.lang.String s, java.lang.Object... params)Write a message with trace level DEBUG to the trace system.- Parameters:
s- the messageparams- the parameters
-
debug
public void debug(java.lang.String s)
Write a message with trace level DEBUG to the trace system.- Parameters:
s- the message
-
debug
public void debug(java.lang.Throwable t, java.lang.String s)Write a message with trace level DEBUG to the trace system.- Parameters:
t- the exceptions- the message
-
infoCode
public void infoCode(java.lang.String java)
Write Java source code with trace level INFO to the trace system.- Parameters:
java- the source code
-
debugCode
void debugCode(java.lang.String java)
Write Java source code with trace level DEBUG to the trace system.- Parameters:
java- the source code
-
-