Package org.h2.message
Class TraceWriterAdapter
- java.lang.Object
-
- org.h2.message.TraceWriterAdapter
-
- All Implemented Interfaces:
TraceWriter
public class TraceWriterAdapter extends java.lang.Object implements TraceWriter
This adapter sends log output to SLF4J. SLF4J supports multiple implementations such as Logback, Log4j, Jakarta Commons Logging (JCL), JDK 1.4 logging, x4juli, and Simple Log. To use SLF4J, you need to add the required jar files to the classpath, and set the trace level to 4 when opening a database:jdbc:h2:˜/test;TRACE_LEVEL_FILE=4
The logger name is 'h2database'.
-
-
Constructor Summary
Constructors Constructor Description TraceWriterAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisEnabled(int level)Check the given trace / log level is enabled.voidsetName(java.lang.String name)Set the name of the database or trace object.voidwrite(int level, int moduleId, java.lang.String s, java.lang.Throwable t)Write a message.voidwrite(int level, java.lang.String module, java.lang.String s, java.lang.Throwable t)Write a message.
-
-
-
Method Detail
-
setName
public void setName(java.lang.String name)
Description copied from interface:TraceWriterSet the name of the database or trace object.- Specified by:
setNamein interfaceTraceWriter- Parameters:
name- the new name
-
isEnabled
public boolean isEnabled(int level)
Description copied from interface:TraceWriterCheck the given trace / log level is enabled.- Specified by:
isEnabledin interfaceTraceWriter- Parameters:
level- the level- Returns:
- true if the level is enabled
-
write
public void write(int level, int moduleId, java.lang.String s, java.lang.Throwable t)Description copied from interface:TraceWriterWrite a message.- Specified by:
writein interfaceTraceWriter- Parameters:
level- the trace levelmoduleId- the id of the modules- the messaget- the exception (may be null)
-
write
public void write(int level, java.lang.String module, java.lang.String s, java.lang.Throwable t)Description copied from interface:TraceWriterWrite a message.- Specified by:
writein interfaceTraceWriter- Parameters:
level- the trace levelmodule- the name of the modules- the messaget- the exception (may be null)
-
-