Tracepublic final class Trace extends Object implements TraceTagsSends trace to a pluggable destination. |
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 void | fine(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.
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 TraceDestination | initDestination()
// 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 boolean | isSelected(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.
final TraceDestination output = out();
if (output != null) return output.isSelected(level,type);
return false;
| private static synchronized TraceDestination | out()Return the trace destination.
return out;
| public static boolean | send(int level, int type, java.lang.String className, java.lang.String methodName, java.lang.String info)Send a new information to this Trace class
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 boolean | send(int level, int type, java.lang.String className, java.lang.String methodName, java.lang.Throwable exception)Send an exception to this Trace class.
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 void | setDestination(TraceDestination output)Set the trace destination.
out = output;
| public static void | warning(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.
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);
|
|