com.sleepycat.je.utilint
Class Tracer

java.lang.Object
  extended by com.sleepycat.je.utilint.Tracer
All Implemented Interfaces:
LoggableObject, LogReadable, LogWritable

public class Tracer
extends Object
implements LoggableObject, LogReadable

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
 boolean countAsObsoleteWhenLogged()
          Returns true if this item should be counted as obsoleted when logged.
 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()
           
 LogEntryType getLogType()
          All objects that are reponsible for a generating a type of log entry must implement this.
 String getMessage()
           
static String getStackTrace(Throwable t)
           
 long getTransactionId()
           
 int hashCode()
          Just in case it's ever used as a hash key.
 boolean logEntryIsTransactional()
           
 boolean marshallOutsideWriteLatch()
          Return true if this item can be marshalled outside the log write latch.
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 postLogWork(long justLoggedLsn)
          Do any processing we need to do after logging, while under the logging latch.
 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

getLogType

public LogEntryType getLogType()
Description copied from interface: LoggableObject
All objects that are reponsible for a generating a type of log entry must implement this.

Specified by:
getLogType in interface LoggableObject
Returns:
the type of log entry
See Also:
LoggableObject.getLogType()

marshallOutsideWriteLatch

public boolean marshallOutsideWriteLatch()
Description copied from interface: LoggableObject
Return true if this item can be marshalled outside the log write latch.

Specified by:
marshallOutsideWriteLatch in interface LoggableObject
See Also:
Can be marshalled outside the log write latch.

countAsObsoleteWhenLogged

public boolean countAsObsoleteWhenLogged()
Description copied from interface: LoggableObject
Returns true if this item should be counted as obsoleted when logged. This currently applies to deleted LNs only.

Specified by:
countAsObsoleteWhenLogged in interface LoggableObject
See Also:
LoggableObject.countAsObsoleteWhenLogged()

postLogWork

public void postLogWork(long justLoggedLsn)
Description copied from interface: LoggableObject
Do any processing we need to do after logging, while under the logging latch.

Specified by:
postLogWork in interface LoggableObject
See Also:
LoggableObject.postLogWork(long)

getLogSize

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

writeToLog

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

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

readFromLog

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

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

dumpLog

public void dumpLog(StringBuffer sb,
                    boolean verbose)
Description copied from interface: LogReadable
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 LogReadable
Parameters:
sb - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
LogReadable.dumpLog(java.lang.StringBuffer, boolean)

logEntryIsTransactional

public boolean logEntryIsTransactional()
Specified by:
logEntryIsTransactional in interface LogReadable
Returns:
true if the LogEntry is a transactional log entry type.
See Also:
LogReadable.logEntryIsTransactional()

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface LogReadable
Returns:
return the transaction id if this log entry is transactional, 0 otherwise.
See Also:
LogReadable.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-2005 Sleepycat, Inc. All Rights Reserved.