net.sf.farrago.util
Class NativeTrace

java.lang.Object
  extended by net.sf.farrago.util.NativeTrace

public class NativeTrace
extends Object

NativeTrace provides integration between native code and Java logging facilities.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/util/NativeTrace.java#16 $
Author:
John V. Sichi

Field Summary
private static NativeTrace instance
           
private  String loggerPrefix
           
private  Map<String,String> perfCounters
           
private  Map<String,String> perfCountersNew
           
private static String SEGMENT_LOGGER_PREFIX
           
private static int TRACE_PERFCOUNTER_BEGIN_SNAPSHOT
           
private static int TRACE_PERFCOUNTER_END_SNAPSHOT
           
private static int TRACE_PERFCOUNTER_UPDATE
           
private static String XO_LOGGER_PREFIX
           
 
Constructor Summary
protected NativeTrace(String loggerPrefix)
          Creates a new NativeTrace object.
 
Method Summary
static void createInstance(String loggerPrefix)
           
private  Logger getLogger(String loggerSuffix, boolean stripLoggerIdentity)
           
 Map<String,String> getPerfCounters()
           
private  int getSourceTraceLevel(String loggerSuffix)
          Called from native code to determine the trace level for a given component.
private  void handlePerfCounter(int iLevel, String loggerSuffix, String message)
           
static NativeTrace instance()
           
private  void trace(String loggerSuffix, int iLevel, String message)
          Called from native code to emit a trace message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static NativeTrace instance

TRACE_PERFCOUNTER_BEGIN_SNAPSHOT

private static final int TRACE_PERFCOUNTER_BEGIN_SNAPSHOT
See Also:
Constant Field Values

TRACE_PERFCOUNTER_END_SNAPSHOT

private static final int TRACE_PERFCOUNTER_END_SNAPSHOT
See Also:
Constant Field Values

TRACE_PERFCOUNTER_UPDATE

private static final int TRACE_PERFCOUNTER_UPDATE
See Also:
Constant Field Values

SEGMENT_LOGGER_PREFIX

private static final String SEGMENT_LOGGER_PREFIX
See Also:
Constant Field Values

XO_LOGGER_PREFIX

private static final String XO_LOGGER_PREFIX
See Also:
Constant Field Values

loggerPrefix

private String loggerPrefix

perfCounters

private Map<String,String> perfCounters

perfCountersNew

private Map<String,String> perfCountersNew
Constructor Detail

NativeTrace

protected NativeTrace(String loggerPrefix)
Creates a new NativeTrace object. Do not construct NativeTrace objects directly. This constructor is protected only for the use of subclasses.

Parameters:
loggerPrefix - prefix to use in constructing logger names
Method Detail

createInstance

public static void createInstance(String loggerPrefix)

instance

public static NativeTrace instance()

getLogger

private Logger getLogger(String loggerSuffix,
                         boolean stripLoggerIdentity)

getSourceTraceLevel

private int getSourceTraceLevel(String loggerSuffix)
Called from native code to determine the trace level for a given component.

Parameters:
loggerSuffix - suffix to use in constructing logger name
Returns:
trace level to use for named source (from Level enum)

trace

private void trace(String loggerSuffix,
                   int iLevel,
                   String message)
Called from native code to emit a trace message.

Parameters:
loggerSuffix - suffix to use in constructing logger name
iLevel - level (from Level enum) at which to trace
message - trace message text

handlePerfCounter

private void handlePerfCounter(int iLevel,
                               String loggerSuffix,
                               String message)

getPerfCounters

public Map<String,String> getPerfCounters()
Returns:
a consistent snapshot of all performance counters currently set