PolicyLoggerpublic final class PolicyLogger extends Object This is a helper class that provides some conveniece methods wrapped around the
standard {@link java.util.logging.Logger} interface. |
Fields Summary |
---|
private static final String | LOGGING_SUBSYSTEM_NAMEIf we run with JAX-WS, we are using its logging domain (appended with ".wspolicy").
Otherwise we default to "wspolicy". | private static final Level | METHOD_CALL_LEVEL_VALUE | private final String | componentClassName | private final Logger | logger |
Constructors Summary |
---|
private PolicyLogger(String componentName)Prevents creation of a new instance of this PolicyLogger
this.componentClassName = "[" + componentName + "] ";
this.logger = java.util.logging.Logger.getLogger(LOGGING_SUBSYSTEM_NAME);
|
Methods Summary |
---|
public void | config(java.lang.String message)
if (!this.logger.isLoggable(Level.CONFIG)) {
return;
}
logger.logp(Level.CONFIG, componentClassName, getCallerMethodName(), message);
| public void | config(java.lang.String message, java.lang.Throwable thrown)
if (!this.logger.isLoggable(Level.CONFIG)) {
return;
}
logger.logp(Level.CONFIG, componentClassName, getCallerMethodName(), message, thrown);
| public void | entering()
if (!this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE)) {
return;
}
logger.entering(componentClassName, getCallerMethodName());
| public void | entering(java.lang.Object parameters)
if (!this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE)) {
return;
}
logger.entering(componentClassName, getCallerMethodName(), parameters);
| public void | exiting()
if (!this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE)) {
return;
}
logger.exiting(componentClassName, getCallerMethodName());
| public void | exiting(java.lang.Object result)
if (!this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE)) {
return;
}
logger.exiting(componentClassName, getCallerMethodName(), result);
| public void | fine(java.lang.String message, java.lang.Throwable thrown)
if (!this.logger.isLoggable(Level.FINE)) {
return;
}
logger.logp(Level.FINE, componentClassName, getCallerMethodName(), message, thrown);
| public void | fine(java.lang.String message)
if (!this.logger.isLoggable(Level.FINE)) {
return;
}
logger.logp(Level.FINE, componentClassName, getCallerMethodName(), message);
| public void | finer(java.lang.String message)
if (!this.logger.isLoggable(Level.FINER)) {
return;
}
logger.logp(Level.FINER, componentClassName, getCallerMethodName(), message);
| public void | finer(java.lang.String message, java.lang.Throwable thrown)
if (!this.logger.isLoggable(Level.FINER)) {
return;
}
logger.logp(Level.FINER, componentClassName, getCallerMethodName(), message, thrown);
| public void | finest(java.lang.String message)
if (!this.logger.isLoggable(Level.FINEST)) {
return;
}
logger.logp(Level.FINEST, componentClassName, getCallerMethodName(), message);
| public void | finest(java.lang.String message, java.lang.Throwable thrown)
if (!this.logger.isLoggable(Level.FINEST)) {
return;
}
logger.logp(Level.FINEST, componentClassName, getCallerMethodName(), message, thrown);
| public static com.sun.xml.ws.policy.privateutil.PolicyLogger | getLogger(java.lang.Class componentClass)The factory method returns preconfigured PolicyLogger wrapper for the class. Since there is no caching implemented,
it is advised that the method is called only once per a class in order to initialize a final static logger variable,
which is then used through the class to perform actual logging tasks.
return new PolicyLogger(componentClass.getName());
| public void | info(java.lang.String message)
if (!this.logger.isLoggable(Level.INFO)) {
return;
}
logger.logp(Level.INFO, componentClassName, getCallerMethodName(), message);
| public void | info(java.lang.String message, java.lang.Throwable thrown)
if (!this.logger.isLoggable(Level.INFO)) {
return;
}
logger.logp(Level.INFO, componentClassName, getCallerMethodName(), message, thrown);
| public boolean | isLoggable(java.util.logging.Level level)
return this.logger.isLoggable(level);
| public boolean | isMethodCallLoggable()
return this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE);
| public void | log(java.util.logging.Level level, java.lang.String message)
if (!this.logger.isLoggable(level)) {
return;
}
logger.logp(level, componentClassName, getCallerMethodName(), message);
| public void | log(java.util.logging.Level level, java.lang.String message, java.lang.Throwable thrown)
if (!this.logger.isLoggable(level)) {
return;
}
logger.logp(level, componentClassName, getCallerMethodName(), message, thrown);
| public T | logException(T exception, java.lang.Throwable cause, java.util.logging.Level level)Method logs {@code exception}'s message at the logging level specified by the
{@code level} argument.
If {@code cause} parameter is not {@code null}, it is logged as well and
{@code exception} original cause is initialized with instance referenced
by {@code cause} parameter.
if (this.logger.isLoggable(level)) {
if (cause == null) {
logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage());
} else {
exception.initCause(cause);
logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage(), cause);
}
}
return exception;
| public T | logException(T exception, boolean logCause, java.util.logging.Level level)Method logs {@code exception}'s message at the logging level specified by the
{@code level} argument.
If {@code logCause} parameter is {@code true}, {@code exception}'s original
cause is logged as well (if exists). This may be used in cases when
{@code exception}'s class provides constructor to initialize the original
cause. In such case you do not need to use
{@link #logException(Throwable, Throwable, Level) logException(exception, cause, level)}
method version but you might still want to log the original cause as well.
if (this.logger.isLoggable(level)) {
if (logCause && exception.getCause() != null) {
logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage(), exception.getCause());
} else {
logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage());
}
}
return exception;
| public T | logException(T exception, java.util.logging.Level level)Same as {@link #logException(Throwable, Throwable, Level)
logException(exception, true, level)}.
if (this.logger.isLoggable(level)) {
if (exception.getCause() == null) {
logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage());
} else {
logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage(), exception.getCause());
}
}
return exception;
| public T | logSevereException(T exception, java.lang.Throwable cause)Method logs {@code exception}'s message as a {@code SEVERE} logging level
message.
If {@code cause} parameter is not {@code null}, it is logged as well and
{@code exception} original cause is initialized with instance referenced
by {@code cause} parameter.
if (this.logger.isLoggable(Level.SEVERE)) {
if (cause == null) {
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage());
} else {
exception.initCause(cause);
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage(), cause);
}
}
return exception;
| public T | logSevereException(T exception, boolean logCause)Method logs {@code exception}'s message as a {@code SEVERE} logging level
message.
If {@code logCause} parameter is {@code true}, {@code exception}'s original
cause is logged as well (if exists). This may be used in cases when
{@code exception}'s class provides constructor to initialize the original
cause. In such case you do not need to use
{@link #logSevereException(Throwable, Throwable)}
method version but you might still want to log the original cause as well.
if (this.logger.isLoggable(Level.SEVERE)) {
if (logCause && exception.getCause() != null) {
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage(), exception.getCause());
} else {
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage());
}
}
return exception;
| public T | logSevereException(T exception)Same as {@link #logSevereException(Throwable, boolean) logSevereException(exception, true)}.
if (this.logger.isLoggable(Level.SEVERE)) {
if (exception.getCause() == null) {
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage());
} else {
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage(), exception.getCause());
}
}
return exception;
| public void | setLevel(java.util.logging.Level level)
this.logger.setLevel(level);
| public void | severe(java.lang.String message)
if (!this.logger.isLoggable(Level.SEVERE)) {
return;
}
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), message);
| public void | severe(java.lang.String message, java.lang.Throwable thrown)
if (!this.logger.isLoggable(Level.SEVERE)) {
return;
}
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), message, thrown);
| public void | warning(java.lang.String message)
if (!this.logger.isLoggable(Level.WARNING)) {
return;
}
logger.logp(Level.WARNING, componentClassName, getCallerMethodName(), message);
| public void | warning(java.lang.String message, java.lang.Throwable thrown)
if (!this.logger.isLoggable(Level.WARNING)) {
return;
}
logger.logp(Level.WARNING, componentClassName, getCallerMethodName(), message, thrown);
|
|