Fields Summary |
---|
private static final long | serialVersionUID |
private static final int | MAJOR |
private static final int | MINOR |
private static long | currentSequenceNumber |
private static ThreadLocal | currentThreadId |
private static int | initThreadId |
private Level | levelThe logging level. |
private long | sequenceNumberThe sequence number. |
private String | sourceClassNameThe name of the class that issued the logging call. |
private String | sourceMethodNameThe name of the method that issued the logging call. |
private String | messageThe original message text. |
private int | threadIDThe ID of the thread that issued the logging call. |
private long | millisThe time that the event occurred, in milliseconds since 1970. |
private Throwable | thrownThe associated {@code Throwable} object if any. |
private String | loggerNameThe name of the source logger. |
private String | resourceBundleNameThe name of the resource bundle used to localize the log message. |
private transient ResourceBundle | resourceBundle |
private transient Object[] | parameters |
private transient boolean | sourceInited |
Methods Summary |
---|
public java.util.logging.Level | getLevel()Gets the logging level.
return level;
|
public java.lang.String | getLoggerName()Gets the name of the logger.
return loggerName;
|
public java.lang.String | getMessage()Gets the raw message.
return message;
|
public long | getMillis()Gets the time when this event occurred, in milliseconds since 1970.
return millis;
|
public java.lang.Object[] | getParameters()Gets the parameters.
return parameters;
|
public java.util.ResourceBundle | getResourceBundle()Gets the resource bundle used to localize the raw message during
formatting.
return resourceBundle;
|
public java.lang.String | getResourceBundleName()Gets the name of the resource bundle.
return resourceBundleName;
|
public long | getSequenceNumber()Gets the sequence number.
return sequenceNumber;
|
public java.lang.String | getSourceClassName()Gets the name of the class that is the source of this log record. This
information can be changed, may be {@code null} and is untrusted.
initSource();
return sourceClassName;
|
public java.lang.String | getSourceMethodName()Gets the name of the method that is the source of this log record.
initSource();
return sourceMethodName;
|
public int | getThreadID()Gets a unique ID of the thread originating the log record. Every thread
becomes a different ID.
Notice : the ID doesn't necessary map the OS thread ID
return threadID;
|
public java.lang.Throwable | getThrown()Gets the {@code Throwable} object associated with this log record.
return thrown;
|
private void | initSource()
if (!sourceInited) {
StackTraceElement[] elements = (new Throwable()).getStackTrace();
int i = 0;
String current = null;
FINDLOG: for (; i < elements.length; i++) {
current = elements[i].getClassName();
if (current.equals(Logger.class.getName())) {
break FINDLOG;
}
}
while(++i<elements.length && elements[i].getClassName().equals(current)) {
// do nothing
}
if (i < elements.length) {
this.sourceClassName = elements[i].getClassName();
this.sourceMethodName = elements[i].getMethodName();
}
sourceInited = true;
}
|
private void | readObject(java.io.ObjectInputStream in)
in.defaultReadObject();
byte major = in.readByte();
byte minor = in.readByte();
//only check MAJOR version
if (major != MAJOR) {
// logging.5=Different version - {0}.{1}
throw new IOException(Messages.getString("logging.5", major, minor)); //$NON-NLS-1$
}
int length = in.readInt();
if (length >= 0) {
parameters = new Object[length];
for (int i = 0; i < parameters.length; i++) {
parameters[i] = in.readObject();
}
}
if (null != resourceBundleName) {
try {
resourceBundle = Logger.loadResourceBundle(resourceBundleName);
} catch (MissingResourceException e) {
// Cannot find the specified resource bundle
resourceBundle = null;
}
}
|
public void | setLevel(java.util.logging.Level level)Sets the logging level.
if (null == level) {
// logging.4=The 'level' parameter is null.
throw new NullPointerException(Messages.getString("logging.4")); //$NON-NLS-1$
}
this.level = level;
|
public void | setLoggerName(java.lang.String loggerName)Sets the name of the logger.
this.loggerName = loggerName;
|
public void | setMessage(java.lang.String message)Sets the raw message. When this record is formatted by a logger that has
a localization resource bundle that contains an entry for {@code message},
then the raw message is replaced with its localized version.
this.message = message;
|
public void | setMillis(long millis)Sets the time when this event occurred, in milliseconds since 1970.
this.millis = millis;
|
public void | setParameters(java.lang.Object[] parameters)Sets the parameters.
this.parameters = parameters;
|
public void | setResourceBundle(java.util.ResourceBundle resourceBundle)Sets the resource bundle.
this.resourceBundle = resourceBundle;
|
public void | setResourceBundleName(java.lang.String resourceBundleName)Sets the name of the resource bundle.
this.resourceBundleName = resourceBundleName;
|
public void | setSequenceNumber(long sequenceNumber)Sets the sequence number. It is usually not necessary to call this method
to change the sequence number because the number is allocated when this
instance is constructed.
this.sequenceNumber = sequenceNumber;
|
public void | setSourceClassName(java.lang.String sourceClassName)Sets the name of the class that is the source of this log record.
sourceInited = true;
this.sourceClassName = sourceClassName;
|
public void | setSourceMethodName(java.lang.String sourceMethodName)Sets the name of the method that is the source of this log record.
sourceInited = true;
this.sourceMethodName = sourceMethodName;
|
public void | setThreadID(int threadID)Sets the ID of the thread originating this log record.
this.threadID = threadID;
|
public void | setThrown(java.lang.Throwable thrown)Sets the {@code Throwable} object associated with this log record.
this.thrown = thrown;
|
private void | writeObject(java.io.ObjectOutputStream out)
out.defaultWriteObject();
out.writeByte(MAJOR);
out.writeByte(MINOR);
if (null == parameters) {
out.writeInt(-1);
} else {
out.writeInt(parameters.length);
for (Object element : parameters) {
out.writeObject(null == element ? null : element.toString());
}
}
|