FileDocCategorySizeDatePackage
Trace.javaAPI DocJava SE 5 API5406Fri Aug 26 14:55:06 BST 2005com.sun.jmx.trace

Trace

public final class Trace extends Object implements TraceTags
Sends trace to a pluggable destination.
since
1.5
since.unbundled
JMX RI 1.2

Fields Summary
private static TraceDestination
out
Constructors Summary
private Trace()

    // private static TraceDestination out = 
    // TraceImplementation.newDestination(2);

    // private constructor defined to "hide" the default public constructor
      
	
    
Methods Summary
public static voidfine(java.lang.String loggerName, java.lang.String msg)
Logs a fine message. This is equivalent to Logger.getLogger(loggerName).fine(msg); This method is a hack for backward compatibility with J2SE 1.3.

since.unbundled
JMX RI 1.2.1

	final TraceDestination output = out();
	if (output instanceof TraceManager)
	    // Log a fine message
	    ((TraceManager)output).fine(loggerName,msg);
	else if (output != null) 
	    // Best effort
	    output.send(LEVEL_TRACE,INFO_MISC,null,null,msg);
    
private static TraceDestinationinitDestination()

      // Attempt to locate class java.util.logging.LogManager
      //
      try
      {
        Class.forName("java.util.logging.LogManager");
        
        // Class could be loaded, use a new instance of TraceManager as the trace
        // destination 
        //
        return new TraceManager();
      }
      catch (ClassNotFoundException e)
      {
        // Class could not be loaded, means that we are running J2SE 1.3 or below.
        //
        return null;
      }
    
public static booleanisSelected(int level, int type)
Verify whether the specified info level and the info type are selected by a listener.

It is strongly recommended to call this method before sending an information to this Trace class.

param
level the level of trace information.
param
type the type of the trace information.

	final TraceDestination output = out();
	if (output != null) return output.isSelected(level,type);
	return false;
    
private static synchronized TraceDestinationout()
Return the trace destination.

	return out;
    
public static booleansend(int level, int type, java.lang.String className, java.lang.String methodName, java.lang.String info)
Send a new information to this Trace class

param
level the level of trace information to be sent.
param
type the type of trace information to be sent.
param
className the name of the class from which the trace information is from.
param
methodName the name of the method from which the trace information is from.
param
info the trace information to be sent.
return
false if the level and the type are not selected.


	final TraceDestination output = out();
	if (output == null) return false;
	if (!(output.isSelected(level, type))) return false;
	return output.send(level,type,className,methodName,info);
    
public static booleansend(int level, int type, java.lang.String className, java.lang.String methodName, java.lang.Throwable exception)
Send an exception to this Trace class.

param
level the level of trace information to be sent.
param
type the type of trace information to be sent.
param
className the name of the class from which the trace information is from.
param
methodName the name of the method from which the trace information is from.
param
exception exception sent as the trace information.

	final TraceDestination output = out();
	if (output == null) return false;
	if (!(output.isSelected(level, type))) return false;
	return output.send(level,type,className,methodName,exception);
    
public static synchronized voidsetDestination(TraceDestination output)
Set the trace destination.

	out = output;
    
public static voidwarning(java.lang.String loggerName, java.lang.String msg)
Logs a warning message. This is equivalent to Logger.getLogger(loggerName).warning(msg); This method is a hack for backward compatibility with J2SE 1.3.

since.unbundled
JMX RI 1.2.1

	final TraceDestination output = out();
	if (output instanceof TraceManager)
	    // Log a warning message
	    ((TraceManager)output).warning(loggerName,msg);
	else if (output != null) 
	    // Best effort
	    output.send(LEVEL_TRACE,INFO_MISC,null,null,msg);