Methods Summary |
---|
public void | config(java.lang.String msg)Log a CONFIG message.
If the logger is currently enabled for the CONFIG message
level then the given message is forwarded to all the
registered output Handler objects.
log(CONFIG, msg);
|
public void | entering(java.lang.String sourceClass, java.lang.String sourceMethod)Log a method entry.
This is a convenience method that can be used to log entry
to a method. A LogRecord with message "ENTRY", log level
FINER, and the given sourceMethod and sourceClass is logged.
entering(sourceClass, sourceMethod, (Object[])null);
|
public void | entering(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object param1)Log a method entry, with one parameter.
This is a convenience method that can be used to log entry
to a method. A LogRecord with message "ENTRY {0}", log level
FINER, and the given sourceMethod, sourceClass, and parameter
is logged.
if (isLoggable(FINER))
entering(sourceClass, sourceMethod, new Object[]{param1});
|
public void | entering(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object[] params)Log a method entry, with an array of parameters.
This is a convenience method that can be used to log entry
to a method. A LogRecord with message "ENTRY" (followed by a
format {N} indicator for each entry in the parameter array),
log level FINER, and the given sourceMethod, sourceClass, and
parameters is logged.
if (isLoggable(FINER))
{
MessageFormat messageFormat = null;
String messageKey = null;
String[] args = null;
if ((params != null) && (params.length > 0))
{
messageKey = "entering_method_params"; // NOI18N
args = new String[]{sourceClass, sourceMethod,
StringHelper.arrayToSeparatedList(Arrays.asList(params))};
}
else
{
messageKey = "entering_method"; // NOI18N
args = new String[]{sourceClass, sourceMethod};
}
messageFormat = new MessageFormat(
getMessages().getString(messageKey));
finer(messageFormat.format(args));
}
|
public void | exiting(java.lang.String sourceClass, java.lang.String sourceMethod)Log a method return.
This is a convenience method that can be used to log returning
from a method. A LogRecord with message "RETURN", log level
FINER, and the given sourceMethod and sourceClass is logged.
exiting(sourceClass, sourceMethod, null);
|
public void | exiting(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object result)Log a method return, with result object.
This is a convenience method that can be used to log returning
from a method. A LogRecord with message "RETURN {0}", log level
FINER, and the gives sourceMethod, sourceClass, and result
object is logged.
if (isLoggable(FINER))
{
MessageFormat messageFormat = null;
String messageKey = null;
Object[] args = null;
if (result != null)
{
messageKey = "exiting_method_return"; // NOI18N
args = new Object[]{sourceClass, sourceMethod, result};
}
else
{
messageKey = "exiting_method"; // NOI18N
args = new Object[]{sourceClass, sourceMethod};
}
messageFormat = new MessageFormat(
getMessages().getString(messageKey));
finer(messageFormat.format(args));
}
|
private java.lang.String | findLevelMatch(java.lang.String loggerName)Find the best matched logging level from the logging properties
Properties properties = getLoggingProperties();
String value = null;
if (properties != null)
{
while (value == null)
{
int lastIndex = loggerName.lastIndexOf(_levelSeparator);
value = properties.getProperty(loggerName + ".level"); // NOI18N
if (loggerName.trim().length() > 0)
{
loggerName = ((lastIndex == -1) ? "" : // NOI18N
loggerName.substring(0, lastIndex));
}
else
return value;
}
}
return value;
|
public void | fine(java.lang.String msg)Log a message.
If the logger is currently enabled for the message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINE, msg);
|
public void | fine(java.lang.String msg, java.lang.Object o1)Log a FINE message.
If the logger is currently enabled for the FINE message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINE, msg, o1);
|
public void | fine(java.lang.String msg, java.lang.Object[] o)Log a FINE message.
If the logger is currently enabled for the FINE message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINE, msg, o);
|
public void | fine(java.lang.String msg, java.lang.Object o1, java.lang.Object o2)Log a FINE message.
If the logger is currently enabled for the FINE message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINE, msg, o1, o2);
|
public void | fine(java.lang.String msg, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)Log a FINE message.
If the logger is currently enabled for the FINE message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINE, msg, o1, o2, o3);
|
public void | finer(java.lang.String msg)Log a FINER message.
If the logger is currently enabled for the FINER message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINER, msg);
|
public void | finer(java.lang.String msg, java.lang.Object[] o)Log a FINER message.
If the logger is currently enabled for the FINER message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINER, msg, o);
|
public void | finer(java.lang.String msg, java.lang.Object o1)Log a FINER message.
If the logger is currently enabled for the FINER message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINER, msg, o1);
|
public void | finer(java.lang.String msg, java.lang.Object o1, java.lang.Object o2)Log a FINER message.
If the logger is currently enabled for the FINER message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINER, msg, o1, o2);
|
public void | finer(java.lang.String msg, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)Log a FINER message.
If the logger is currently enabled for the FINER message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINER, msg, o1, o2, o3);
|
public void | finest(java.lang.String msg)Log a FINEST message.
If the logger is currently enabled for the FINEST message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINEST, msg);
|
public void | finest(java.lang.String msg, java.lang.Object[] o)Log a FINEST message.
If the logger is currently enabled for the FINEST message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINEST, msg, o);
|
public void | finest(java.lang.String msg, java.lang.Object o1)Log a FINEST message.
If the logger is currently enabled for the FINEST message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINEST, msg, o1);
|
public void | finest(java.lang.String msg, java.lang.Object o1, java.lang.Object o2)Log a FINEST message.
If the logger is currently enabled for the FINEST message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINEST, msg, o1, o2);
|
public void | finest(java.lang.String msg, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)Log a FINEST message.
If the logger is currently enabled for the FINEST message
level then the given message is forwarded to all the
registered output Handler objects.
log(FINEST, msg, o1, o2, o3);
|
protected java.util.ResourceBundle | getBundle()Get the message bundle for the named instance of the logger. return _bundle;
|
public int | getLevel() return _level;
|
private static java.util.Map | getLevelNameMap() return _levelNamesToValues;
|
private static synchronized java.util.Properties | getLoggingProperties()
if (_hasLoggingProperties && (_loggingProperties == null))
{
String fileName =
System.getProperty("java.util.logging.config.file"); // NOI18N
if (fileName == null)
{
fileName = System.getProperty("java.home"); // NOI18N
if (fileName != null)
{
File file = new File(fileName, "lib"); // NOI18N
file = new File(file, "logging.properties"); // NOI18N
try
{
fileName = file.getCanonicalPath();
}
catch (IOException ioe)
{
fileName = null;
}
}
}
if (fileName != null)
{
InputStream inputStream = null;
File file = null;
try
{
Properties properties = new Properties();
BufferedInputStream bufferedInputStream = null;
inputStream = new FileInputStream(fileName);
bufferedInputStream = new BufferedInputStream(inputStream);
properties.load(bufferedInputStream);
_loggingProperties = properties;
}
catch (Exception e)
{
_hasLoggingProperties = false;
}
finally
{
if (inputStream != null)
{
try
{
inputStream.close();
}
catch (IOException ioe)
{
// couldn't close it for some reason
}
}
}
}
else
_hasLoggingProperties = false;
}
return _loggingProperties;
|
protected java.lang.String | getMessage(java.lang.String message)This method returns a string from the bundle file if possible,
treating the message argument as the key. If no such key is found
in the bundle, the message itself is returned.
try
{
return getBundle().getString(message);
}
catch (MissingResourceException e)
{
return message;
}
|
protected java.lang.String | getMessageWithPrefix(int level, java.lang.String message)This method returns a string with a formatted prefix which
depends on the level.
MessageFormat messageFormat = new MessageFormat(
getMessages().getString("logging_prefix")); // NOI18N
return messageFormat.format(
new String[]{toString(level), message});
|
protected static java.util.ResourceBundle | getMessages()Get the message bundle for the AbstractLogger itself. return _messages;
|
public java.lang.String | getName()Get the name for this logger. return _loggerName;
|
public void | info(java.lang.String msg)Log an INFO message.
If the logger is currently enabled for the INFO message
level then the given message is forwarded to all the
registered output Handler objects.
log(INFO, msg);
|
public boolean | isLoggable()Return whether logging is enabled at the FINE level. This method
is not exact because to make it accurately reflect the logging level
we would have to include the JDK 1.4 java.util.logging.Level class.
This method does not delegate to isLoggable(FINE) for performance
reasons. return (FINE >= getLevel());
|
public boolean | isLoggable(int levelValue)Check if a message of the given level would actually be logged
by this logger. This check is based on the Logger's effective level,
which may be inherited from its parent.
return (levelValue >= getLevel());
|
public void | log(int level, java.lang.String msg)Log a message.
If the logger is currently enabled for the message
level then the given message is forwarded to all the
registered output Handler objects.
if (isLoggable(level))
logInternal(level, getMessage(msg));
|
public void | log(int level, java.lang.String msg, java.lang.Object o1)Log a message.
If the logger is currently enabled for the message
level then the given message is forwarded to all the
registered output Handler objects.
if (isLoggable(level))
log(level, msg, new Object[]{o1});
|
public void | log(int level, java.lang.String msg, java.lang.Object[] o)Log a message.
If the logger is currently enabled for the message
level then the given message is forwarded to all the
registered output Handler objects.
if (isLoggable(level))
{
int count = ((o == null) ? 0 : o.length);
String formattedMessage = msg;
if (count > 0)
{
MessageFormat messageFormat =
new MessageFormat(getBundle().getString(msg));
if (messageFormat != null)
formattedMessage = messageFormat.format(o);
}
else
formattedMessage = getMessage(msg);
logInternal(level, formattedMessage);
}
|
public void | log(int level, java.lang.String msg, java.lang.Object o1, java.lang.Object o2)Log a message.
If the logger is currently enabled for the message
level then the given message is forwarded to all the
registered output Handler objects.
if (isLoggable(level))
log(level, msg, new Object[]{o1, o2});
|
public void | log(int level, java.lang.String msg, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)Log a message.
If the logger is currently enabled for the message
level then the given message is forwarded to all the
registered output Handler objects.
if (isLoggable(level))
log(level, msg, new Object[]{o1, o2, o3});
|
public abstract void | log(int level, java.lang.String msg, java.lang.Throwable thrown)Log a message.
If the logger is currently enabled for the message
level then the given message, and the exception dump,
is forwarded to all the
registered output Handler objects.
|
protected abstract void | logInternal(int level, java.lang.String message)This method does the actual logging. It is expected that if a
check for isLoggable is desired for performance reasons, it has
already been done, as it should not be done here.
|
private int | readLoggingLevel(java.lang.String loggerName)
String value = findLevelMatch(loggerName);
int level = _defaultLevel;
if (value != null)
{
Object lookupValue = null;
value = value.trim();
lookupValue = getLevelNameMap().get(value);
if (lookupValue != null)
level = ((Integer)lookupValue).intValue();
else // maybe a number was specified
{
try
{
level = Integer.parseInt(value);
}
catch (NumberFormatException nfe)
{
// level will be the default
}
}
}
return level;
|
public void | severe(java.lang.String msg)Log a SEVERE message.
If the logger is currently enabled for the SEVERE message
level then the given message is forwarded to all the
registered output Handler objects.
log(SEVERE, msg);
|
public void | throwing(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Throwable thrown)Log throwing an exception.
This is a convenience method to log that a method is
terminating by throwing an exception. The logging is done
using the FINER level.
If the logger is currently enabled for the given message
level then the given arguments are stored in a LogRecord
which is forwarded to all registered output handlers. The
LogRecord's message is set to "THROW".
Note that the thrown argument is stored in the LogRecord thrown
property, rather than the LogRecord parameters property. Thus is it
processed specially by output Formatters and is not treated
as a formatting parameter to the LogRecord message property.
if (isLoggable(FINER))
{
MessageFormat messageFormat = new MessageFormat(
getMessages().getString("throwing_method"));
log(FINER, messageFormat.format(
new String[]{sourceClass, sourceMethod}), thrown);
}
|
public java.lang.String | toString()Prepare a printable version of this instance.
StringBuffer buffer = new StringBuffer(getClass().getName());
buffer.append(": "); //NOI18N
buffer.append(" name: "); //NOI18N
buffer.append(getName());
buffer.append(", logging level: "); //NOI18N
buffer.append(toString(getLevel()));
return buffer.toString();
|
public static java.lang.String | toString(int level)Return the string name of a level given its int value.
String bundleKey = null;
switch (level)
{
case Logger.OFF:
bundleKey = "utility.level_off"; // NOI18N
break;
case Logger.SEVERE:
bundleKey = "utility.level_severe"; // NOI18N
break;
case Logger.WARNING:
bundleKey = "utility.level_warning"; // NOI18N
break;
case Logger.INFO:
bundleKey = "utility.level_info"; // NOI18N
break;
case Logger.CONFIG:
bundleKey = "utility.level_config"; // NOI18N
break;
case Logger.FINE:
bundleKey = "utility.level_fine"; // NOI18N
break;
case Logger.FINER:
bundleKey = "utility.level_finer"; // NOI18N
break;
case Logger.FINEST:
bundleKey = "utility.level_finest"; // NOI18N
break;
case Logger.ALL:
bundleKey = "utility.level_all"; // NOI18N
break;
}
return ((bundleKey != null) ?
I18NHelper.getMessage(getMessages(), bundleKey) : null);
|
public void | warning(java.lang.String msg)Log a WARNING message.
If the logger is currently enabled for the WARNING message
level then the given message is forwarded to all the
registered output Handler objects.
log(WARNING, msg);
|