com.sleepycat.je.utilint
Class Tracer

java.lang.Object
  extended by com.sleepycat.je.utilint.Tracer
All Implemented Interfaces:
Loggable

public class Tracer
extends Object
implements Loggable

The Tracer generates debug messages that are sent to the java.util.Logging facility. There are three log handlers set up for logging -- the database log itself, an output file, and stdout (the "console"). By default, only the database file is enabled.


Field Summary
static String INFO_FILES
           
 
Constructor Summary
Tracer()
          Create trace record that will be filled in from the log.
Tracer(String msg)
          Create a new debug record.
 
Method Summary
 void dumpLog(StringBuffer sb, boolean verbose)
          Write the object into the string buffer for log dumping.
 boolean equals(Object obj)
          Override Object.equals
 int getLogSize()
           
 String getMessage()
           
static String getStackTrace(Throwable t)
           
 long getTransactionId()
           
 int hashCode()
          Just in case it's ever used as a hash key.
 long log(LogManager logManager)
          Convenience method to create a log entry containing this trace msg.
static Level parseLevel(EnvironmentImpl envImpl, ConfigParam configParam)
          Parse a logging level config parameter, and return a more explanatory error message if it doesn't parse.
 void readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion)
          Initialize this object from the data in itemBuf.
 String toString()
           
static void trace(EnvironmentImpl envImpl, String sourceClass, String sourceMethod, String msg, Throwable t)
          Logger method for recording an exception and stacktrace.
static void trace(Level logLevel, EnvironmentImpl envImpl, String msg)
          Logger method for recording a general message.
 void writeToLog(ByteBuffer logBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INFO_FILES

public static final String INFO_FILES
See Also:
Constant Field Values
Constructor Detail

Tracer

public Tracer(String msg)
Create a new debug record.


Tracer

public Tracer()
Create trace record that will be filled in from the log.

Method Detail

trace

public static void trace(Level logLevel,
                         EnvironmentImpl envImpl,
                         String msg)
Logger method for recording a general message.


trace

public static void trace(EnvironmentImpl envImpl,
                         String sourceClass,
                         String sourceMethod,
                         String msg,
                         Throwable t)
Logger method for recording an exception and stacktrace.


parseLevel

public static Level parseLevel(EnvironmentImpl envImpl,
                               ConfigParam configParam)
                        throws DatabaseException
Parse a logging level config parameter, and return a more explanatory error message if it doesn't parse.

Throws:
DatabaseException

getMessage

public String getMessage()

getStackTrace

public static String getStackTrace(Throwable t)
Returns:
the stacktrace for an exception

log

public long log(LogManager logManager)
         throws DatabaseException
Convenience method to create a log entry containing this trace msg.

Throws:
DatabaseException

getLogSize

public int getLogSize()
Specified by:
getLogSize in interface Loggable
Returns:
number of bytes used to store this object.
See Also:
Loggable.getLogSize()

writeToLog

public void writeToLog(ByteBuffer logBuffer)
Description copied from interface: Loggable
Serialize this object into the buffer.

Specified by:
writeToLog in interface Loggable
Parameters:
logBuffer - is the destination buffer
See Also:
Loggable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(ByteBuffer itemBuffer,
                        byte entryTypeVersion)
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable
See Also:
Loggable.readFromLog(java.nio.ByteBuffer, byte)

dumpLog

public void dumpLog(StringBuffer sb,
                    boolean verbose)
Description copied from interface: Loggable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface Loggable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
Loggable.dumpLog(java.lang.StringBuffer, boolean)

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface Loggable
Returns:
the transaction id embedded within this loggable object. Objects that have no transaction id should return 0.
See Also:
Loggable.getTransactionId()

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Just in case it's ever used as a hash key.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Override Object.equals

Overrides:
equals in class Object


Copyright 2004,2008 Oracle. All rights reserved.