Top Description Fields Constructors Methods
org.h2.message

public Class TraceWriterAdapter

extends Object
implements TraceWriter
Class Inheritance
All Implemented Interfaces
org.h2.message.TraceWriter
Imports
org.slf4j.Logger, .LoggerFactory

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'.

Field Summary

Modifier and TypeField and Description
private final Logger
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
isEnabled(int
the level
level
)

Implements org.h2.message.TraceWriter.isEnabled.

Check the given trace / log level is enabled.

public void
setName(String
the new name
name
)

Implements org.h2.message.TraceWriter.setName.

Set the name of the database or trace object.

public void
write(int
the trace level
level
,
int
the id of the module
moduleId
,
String
the message
s
,
Throwable
the exception (may be null)
t
)

Implements org.h2.message.TraceWriter.write.

Write a message.

public void
write(int
the trace level
level
,
String
the name of the module
module
,
String
the message
s
,
Throwable
the exception (may be null)
t
)

Implements org.h2.message.TraceWriter.write.

Write a message.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private final Logger logger
nameback to summary
private String name

Constructor Detail

TraceWriterAdapterback to summary
public TraceWriterAdapter()

Method Detail

isEnabledback to summary
public boolean isEnabled(int level)

Implements org.h2.message.TraceWriter.isEnabled.

Doc from org.h2.message.TraceWriter.isEnabled.

Check the given trace / log level is enabled.

Parameters
level:int

the level

Returns:boolean

true if the level is enabled

Annotations
@Override
setNameback to summary
public void setName(String name)

Implements org.h2.message.TraceWriter.setName.

Doc from org.h2.message.TraceWriter.setName.

Set the name of the database or trace object.

Parameters
name:String

the new name

Annotations
@Override
writeback to summary
public void write(int level, int moduleId, String s, Throwable t)

Implements org.h2.message.TraceWriter.write.

Doc from org.h2.message.TraceWriter.write.

Write a message.

Parameters
level:int

the trace level

moduleId:int

the id of the module

s:String

the message

t:Throwable

the exception (may be null)

Annotations
@Override
writeback to summary
public void write(int level, String module, String s, Throwable t)

Implements org.h2.message.TraceWriter.write.

Doc from org.h2.message.TraceWriter.write.

Write a message.

Parameters
level:int

the trace level

module:String

the name of the module

s:String

the message

t:Throwable

the exception (may be null)

Annotations
@Override