emptyMap() : map;
}
public Object putMdc(String key, Object val) {
try {
return MDC.get(key);
} finally {
MDC.put(key, val);
}
}
public void removeMdc(String key) {
MDC.remove(key);
}
public void clearNdc() {
NDC.remove();
}
public String getNdc() {
return NDC.get();
}
public int getNdcDepth() {
return NDC.getDepth();
}
public String peekNdc() {
return NDC.peek();
}
public String popNdc() {
return NDC.pop();
}
public void pushNdc(String message) {
NDC.push(message);
}
public void setNdcMaxDepth(int maxDepth) {
NDC.setMaxDepth(maxDepth);
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/Logger.java 0000664 0000000 0000000 00000264633 14167375145 0025423 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2011 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.security.PrivilegedAction;
import java.util.Locale;
import static java.security.AccessController.doPrivileged;
/**
* An abstracted logging entry point.
*/
public abstract class Logger implements Serializable, BasicLogger {
private static final long serialVersionUID = 4232175575988879434L;
private static final String FQCN = Logger.class.getName();
/**
* Levels used by this logging API.
*/
public enum Level {
FATAL,
ERROR,
WARN,
INFO,
DEBUG,
TRACE,
}
private final String name;
/**
* Construct a new instance.
*
* @param name the logger category name
*/
protected Logger(final String name) {
this.name = name;
}
/**
* Return the name of this logger.
*
* @return The name of this logger.
*/
public String getName() {
return name;
}
/**
* Implementation log method (standard parameter formatting).
*
* @param level the level
* @param loggerClassName the logger class name
* @param message the message to log
* @param parameters the parameters of the message
* @param thrown the exception which was thrown, if any
*/
protected abstract void doLog(Level level, String loggerClassName, Object message, Object[] parameters, Throwable thrown);
/**
* Implementation log method (printf formatting).
*
* @param level the level
* @param loggerClassName the logger class name
* @param format the format string to log
* @param parameters the parameters of the message
* @param thrown the exception which was thrown, if any
*/
protected abstract void doLogf(Level level, String loggerClassName, String format, Object[] parameters, Throwable thrown);
/**
* Check to see if the {@code TRACE} level is enabled for this logger.
*
* @return {@code true} if messages logged at {@link Level#TRACE} may be accepted, {@code false} otherwise
*/
public boolean isTraceEnabled() {
return isEnabled(Level.TRACE);
}
/**
* Issue a log message with a level of TRACE.
*
* @param message the message
*/
public void trace(Object message) {
doLog(Level.TRACE, FQCN, message, null, null);
}
/**
* Issue a log message and throwable with a level of TRACE.
*
* @param message the message
* @param t the throwable
*/
public void trace(Object message, Throwable t) {
doLog(Level.TRACE, FQCN, message, null, t);
}
/**
* Issue a log message and throwable with a level of TRACE and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param t the throwable
*/
public void trace(String loggerFqcn, Object message, Throwable t) {
doLog(Level.TRACE, loggerFqcn, message, null, t);
}
/**
* Issue a log message with parameters with a level of TRACE.
*
* @param message the message
* @param params the message parameters
* @deprecated To log a message with parameters, using {@link #tracev(String, Object...)} is recommended.
*/
@Deprecated
public void trace(Object message, Object[] params) {
doLog(Level.TRACE, FQCN, message, params, null);
}
/**
* Issue a log message with parameters and a throwable with a level of TRACE.
*
* @param message the message
* @param params the message parameters
* @param t the throwable
* @deprecated To log a message with parameters, using {@link #tracev(Throwable, String, Object...)} is recommended.
*/
@Deprecated
public void trace(Object message, Object[] params, Throwable t) {
doLog(Level.TRACE, FQCN, message, params, t);
}
/**
* Issue a log message with parameters and a throwable with a level of TRACE.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param params the message parameters
* @param t the throwable
*/
public void trace(String loggerFqcn, Object message, Object[] params, Throwable t) {
doLog(Level.TRACE, loggerFqcn, message, params, t);
}
/**
* Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param params the parameters
*/
public void tracev(String format, Object... params) {
doLog(Level.TRACE, FQCN, format, params, null);
}
/**
* Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the sole parameter
*/
public void tracev(String format, Object param1) {
if (isEnabled(Level.TRACE)) {
doLog(Level.TRACE, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void tracev(String format, Object param1, Object param2) {
if (isEnabled(Level.TRACE)) {
doLog(Level.TRACE, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void tracev(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.TRACE)) {
doLog(Level.TRACE, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param params the parameters
*/
public void tracev(Throwable t, String format, Object... params) {
doLog(Level.TRACE, FQCN, format, params, t);
}
/**
* Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the sole parameter
*/
public void tracev(Throwable t, String format, Object param1) {
if (isEnabled(Level.TRACE)) {
doLog(Level.TRACE, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void tracev(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.TRACE)) {
doLog(Level.TRACE, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a log message with a level of TRACE using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void tracev(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.TRACE)) {
doLog(Level.TRACE, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a formatted log message with a level of TRACE.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param params the parameters
*/
public void tracef(String format, Object... params) {
doLogf(Level.TRACE, FQCN, format, params, null);
}
/**
* Issue a formatted log message with a level of TRACE.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the sole parameter
*/
public void tracef(String format, Object param1) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a formatted log message with a level of TRACE.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void tracef(String format, Object param1, Object param2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a formatted log message with a level of TRACE.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void tracef(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a formatted log message with a level of TRACE.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param params the parameters
*/
public void tracef(Throwable t, String format, Object... params) {
doLogf(Level.TRACE, FQCN, format, params, t);
}
/**
* Issue a formatted log message with a level of TRACE.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the sole parameter
*/
public void tracef(Throwable t, String format, Object param1) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a formatted log message with a level of TRACE.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void tracef(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a formatted log message with a level of TRACE.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void tracef(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
public void tracef(final String format, final int arg) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg }, null);
}
}
public void tracef(final String format, final int arg1, final int arg2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2 }, null);
}
}
public void tracef(final String format, final int arg1, final Object arg2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2 }, null);
}
}
public void tracef(final String format, final int arg1, final int arg2, final int arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void tracef(final String format, final int arg1, final int arg2, final Object arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void tracef(final String format, final int arg1, final Object arg2, final Object arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void tracef(final Throwable t, final String format, final int arg) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg }, t);
}
}
public void tracef(final Throwable t, final String format, final int arg1, final int arg2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2 }, t);
}
}
public void tracef(final Throwable t, final String format, final int arg1, final Object arg2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2 }, t);
}
}
public void tracef(final Throwable t, final String format, final int arg1, final int arg2, final int arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void tracef(final Throwable t, final String format, final int arg1, final int arg2, final Object arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void tracef(final Throwable t, final String format, final int arg1, final Object arg2, final Object arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void tracef(final String format, final long arg) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg }, null);
}
}
public void tracef(final String format, final long arg1, final long arg2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2 }, null);
}
}
public void tracef(final String format, final long arg1, final Object arg2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2 }, null);
}
}
public void tracef(final String format, final long arg1, final long arg2, final long arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void tracef(final String format, final long arg1, final long arg2, final Object arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void tracef(final String format, final long arg1, final Object arg2, final Object arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void tracef(final Throwable t, final String format, final long arg) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg }, t);
}
}
public void tracef(final Throwable t, final String format, final long arg1, final long arg2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2 }, t);
}
}
public void tracef(final Throwable t, final String format, final long arg1, final Object arg2) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2 }, t);
}
}
public void tracef(final Throwable t, final String format, final long arg1, final long arg2, final long arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void tracef(final Throwable t, final String format, final long arg1, final long arg2, final Object arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void tracef(final Throwable t, final String format, final long arg1, final Object arg2, final Object arg3) {
if (isEnabled(Level.TRACE)) {
doLogf(Level.TRACE, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
/**
* Check to see if the {@code DEBUG} level is enabled for this logger.
*
* @return {@code true} if messages logged at {@link Level#DEBUG} may be accepted, {@code false} otherwise
*/
public boolean isDebugEnabled() {
return isEnabled(Level.DEBUG);
}
/**
* Issue a log message with a level of DEBUG.
*
* @param message the message
*/
public void debug(Object message) {
doLog(Level.DEBUG, FQCN, message, null, null);
}
/**
* Issue a log message and throwable with a level of DEBUG.
*
* @param message the message
* @param t the throwable
*/
public void debug(Object message, Throwable t) {
doLog(Level.DEBUG, FQCN, message, null, t);
}
/**
* Issue a log message and throwable with a level of DEBUG and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param t the throwable
*/
public void debug(String loggerFqcn, Object message, Throwable t) {
doLog(Level.DEBUG, loggerFqcn, message, null, t);
}
/**
* Issue a log message with parameters with a level of DEBUG.
*
* @param message the message
* @param params the message parameters
* @deprecated To log a message with parameters, using {@link #debugv(String, Object...)} is recommended.
*/
@Deprecated
public void debug(Object message, Object[] params) {
doLog(Level.DEBUG, FQCN, message, params, null);
}
/**
* Issue a log message with parameters and a throwable with a level of DEBUG.
*
* @param message the message
* @param params the message parameters
* @param t the throwable
* @deprecated To log a message with parameters, using {@link #debugv(Throwable, String, Object...)} is recommended.
*/
@Deprecated
public void debug(Object message, Object[] params, Throwable t) {
doLog(Level.DEBUG, FQCN, message, params, t);
}
/**
* Issue a log message with parameters and a throwable with a level of DEBUG.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param params the message parameters
* @param t the throwable
*/
public void debug(String loggerFqcn, Object message, Object[] params, Throwable t) {
doLog(Level.DEBUG, loggerFqcn, message, params, t);
}
/**
* Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param params the parameters
*/
public void debugv(String format, Object... params) {
doLog(Level.DEBUG, FQCN, format, params, null);
}
/**
* Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the sole parameter
*/
public void debugv(String format, Object param1) {
if (isEnabled(Level.DEBUG)) {
doLog(Level.DEBUG, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void debugv(String format, Object param1, Object param2) {
if (isEnabled(Level.DEBUG)) {
doLog(Level.DEBUG, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void debugv(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.DEBUG)) {
doLog(Level.DEBUG, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param params the parameters
*/
public void debugv(Throwable t, String format, Object... params) {
doLog(Level.DEBUG, FQCN, format, params, t);
}
/**
* Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the sole parameter
*/
public void debugv(Throwable t, String format, Object param1) {
if (isEnabled(Level.DEBUG)) {
doLog(Level.DEBUG, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void debugv(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.DEBUG)) {
doLog(Level.DEBUG, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void debugv(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.DEBUG)) {
doLog(Level.DEBUG, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a formatted log message with a level of DEBUG.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param params the parameters
*/
public void debugf(String format, Object... params) {
doLogf(Level.DEBUG, FQCN, format, params, null);
}
/**
* Issue a formatted log message with a level of DEBUG.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the sole parameter
*/
public void debugf(String format, Object param1) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a formatted log message with a level of DEBUG.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void debugf(String format, Object param1, Object param2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a formatted log message with a level of DEBUG.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void debugf(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a formatted log message with a level of DEBUG.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param params the parameters
*/
public void debugf(Throwable t, String format, Object... params) {
doLogf(Level.DEBUG, FQCN, format, params, t);
}
/**
* Issue a formatted log message with a level of DEBUG.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the sole parameter
*/
public void debugf(Throwable t, String format, Object param1) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a formatted log message with a level of DEBUG.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void debugf(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a formatted log message with a level of DEBUG.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void debugf(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
public void debugf(final String format, final int arg) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg }, null);
}
}
public void debugf(final String format, final int arg1, final int arg2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2 }, null);
}
}
public void debugf(final String format, final int arg1, final Object arg2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2 }, null);
}
}
public void debugf(final String format, final int arg1, final int arg2, final int arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void debugf(final String format, final int arg1, final int arg2, final Object arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void debugf(final String format, final int arg1, final Object arg2, final Object arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void debugf(final Throwable t, final String format, final int arg) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg }, t);
}
}
public void debugf(final Throwable t, final String format, final int arg1, final int arg2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2 }, t);
}
}
public void debugf(final Throwable t, final String format, final int arg1, final Object arg2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2 }, t);
}
}
public void debugf(final Throwable t, final String format, final int arg1, final int arg2, final int arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void debugf(final Throwable t, final String format, final int arg1, final int arg2, final Object arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void debugf(final Throwable t, final String format, final int arg1, final Object arg2, final Object arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void debugf(final String format, final long arg) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg }, null);
}
}
public void debugf(final String format, final long arg1, final long arg2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2 }, null);
}
}
public void debugf(final String format, final long arg1, final Object arg2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2 }, null);
}
}
public void debugf(final String format, final long arg1, final long arg2, final long arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void debugf(final String format, final long arg1, final long arg2, final Object arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void debugf(final String format, final long arg1, final Object arg2, final Object arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, null);
}
}
public void debugf(final Throwable t, final String format, final long arg) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg }, t);
}
}
public void debugf(final Throwable t, final String format, final long arg1, final long arg2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2 }, t);
}
}
public void debugf(final Throwable t, final String format, final long arg1, final Object arg2) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2 }, t);
}
}
public void debugf(final Throwable t, final String format, final long arg1, final long arg2, final long arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void debugf(final Throwable t, final String format, final long arg1, final long arg2, final Object arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
public void debugf(final Throwable t, final String format, final long arg1, final Object arg2, final Object arg3) {
if (isEnabled(Level.DEBUG)) {
doLogf(Level.DEBUG, FQCN, format, new Object[] { arg1, arg2, arg3 }, t);
}
}
/**
* Check to see if the {@code INFO} level is enabled for this logger.
*
* @return {@code true} if messages logged at {@link Level#INFO} may be accepted, {@code false} otherwise
*/
public boolean isInfoEnabled() {
return isEnabled(Level.INFO);
}
/**
* Issue a log message with a level of INFO.
*
* @param message the message
*/
public void info(Object message) {
doLog(Level.INFO, FQCN, message, null, null);
}
/**
* Issue a log message and throwable with a level of INFO.
*
* @param message the message
* @param t the throwable
*/
public void info(Object message, Throwable t) {
doLog(Level.INFO, FQCN, message, null, t);
}
/**
* Issue a log message and throwable with a level of INFO and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param t the throwable
*/
public void info(String loggerFqcn, Object message, Throwable t) {
doLog(Level.INFO, loggerFqcn, message, null, t);
}
/**
* Issue a log message with parameters with a level of INFO.
*
* @param message the message
* @param params the message parameters
* @deprecated To log a message with parameters, using {@link #infov(String, Object...)} is recommended.
*/
@Deprecated
public void info(Object message, Object[] params) {
doLog(Level.INFO, FQCN, message, params, null);
}
/**
* Issue a log message with parameters and a throwable with a level of INFO.
*
* @param message the message
* @param params the message parameters
* @param t the throwable
* @deprecated To log a message with parameters, using {@link #infov(Throwable, String, Object...)} is recommended.
*/
@Deprecated
public void info(Object message, Object[] params, Throwable t) {
doLog(Level.INFO, FQCN, message, params, t);
}
/**
* Issue a log message with parameters and a throwable with a level of INFO.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param params the message parameters
* @param t the throwable
*/
public void info(String loggerFqcn, Object message, Object[] params, Throwable t) {
doLog(Level.INFO, loggerFqcn, message, params, t);
}
/**
* Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param params the parameters
*/
public void infov(String format, Object... params) {
doLog(Level.INFO, FQCN, format, params, null);
}
/**
* Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the sole parameter
*/
public void infov(String format, Object param1) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void infov(String format, Object param1, Object param2) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void infov(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param params the parameters
*/
public void infov(Throwable t, String format, Object... params) {
doLog(Level.INFO, FQCN, format, params, t);
}
/**
* Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the sole parameter
*/
public void infov(Throwable t, String format, Object param1) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void infov(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void infov(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.INFO)) {
doLog(Level.INFO, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a formatted log message with a level of INFO.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param params the parameters
*/
public void infof(String format, Object... params) {
doLogf(Level.INFO, FQCN, format, params, null);
}
/**
* Issue a formatted log message with a level of INFO.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the sole parameter
*/
public void infof(String format, Object param1) {
if (isEnabled(Level.INFO)) {
doLogf(Level.INFO, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a formatted log message with a level of INFO.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void infof(String format, Object param1, Object param2) {
if (isEnabled(Level.INFO)) {
doLogf(Level.INFO, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a formatted log message with a level of INFO.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void infof(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.INFO)) {
doLogf(Level.INFO, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a formatted log message with a level of INFO.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param params the parameters
*/
public void infof(Throwable t, String format, Object... params) {
doLogf(Level.INFO, FQCN, format, params, t);
}
/**
* Issue a formatted log message with a level of INFO.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the sole parameter
*/
public void infof(Throwable t, String format, Object param1) {
if (isEnabled(Level.INFO)) {
doLogf(Level.INFO, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a formatted log message with a level of INFO.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void infof(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.INFO)) {
doLogf(Level.INFO, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a formatted log message with a level of INFO.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void infof(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.INFO)) {
doLogf(Level.INFO, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a log message with a level of WARN.
*
* @param message the message
*/
public void warn(Object message) {
doLog(Level.WARN, FQCN, message, null, null);
}
/**
* Issue a log message and throwable with a level of WARN.
*
* @param message the message
* @param t the throwable
*/
public void warn(Object message, Throwable t) {
doLog(Level.WARN, FQCN, message, null, t);
}
/**
* Issue a log message and throwable with a level of WARN and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param t the throwable
*/
public void warn(String loggerFqcn, Object message, Throwable t) {
doLog(Level.WARN, loggerFqcn, message, null, t);
}
/**
* Issue a log message with parameters with a level of WARN.
*
* @param message the message
* @param params the message parameters
* @deprecated To log a message with parameters, using {@link #warnv(String, Object...)} is recommended.
*/
@Deprecated
public void warn(Object message, Object[] params) {
doLog(Level.WARN, FQCN, message, params, null);
}
/**
* Issue a log message with parameters and a throwable with a level of WARN.
*
* @param message the message
* @param params the message parameters
* @param t the throwable
* @deprecated To log a message with parameters, using {@link #warnv(Throwable, String, Object...)} is recommended.
*/
@Deprecated
public void warn(Object message, Object[] params, Throwable t) {
doLog(Level.WARN, FQCN, message, params, t);
}
/**
* Issue a log message with parameters and a throwable with a level of WARN.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param params the message parameters
* @param t the throwable
*/
public void warn(String loggerFqcn, Object message, Object[] params, Throwable t) {
doLog(Level.WARN, loggerFqcn, message, params, t);
}
/**
* Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param params the parameters
*/
public void warnv(String format, Object... params) {
doLog(Level.WARN, FQCN, format, params, null);
}
/**
* Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the sole parameter
*/
public void warnv(String format, Object param1) {
if (isEnabled(Level.WARN)) {
doLog(Level.WARN, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void warnv(String format, Object param1, Object param2) {
if (isEnabled(Level.WARN)) {
doLog(Level.WARN, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void warnv(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.WARN)) {
doLog(Level.WARN, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param params the parameters
*/
public void warnv(Throwable t, String format, Object... params) {
doLog(Level.WARN, FQCN, format, params, t);
}
/**
* Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the sole parameter
*/
public void warnv(Throwable t, String format, Object param1) {
if (isEnabled(Level.WARN)) {
doLog(Level.WARN, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void warnv(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.WARN)) {
doLog(Level.WARN, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void warnv(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.WARN)) {
doLog(Level.WARN, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a formatted log message with a level of WARN.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param params the parameters
*/
public void warnf(String format, Object... params) {
doLogf(Level.WARN, FQCN, format, params, null);
}
/**
* Issue a formatted log message with a level of WARN.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the sole parameter
*/
public void warnf(String format, Object param1) {
if (isEnabled(Level.WARN)) {
doLogf(Level.WARN, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a formatted log message with a level of WARN.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void warnf(String format, Object param1, Object param2) {
if (isEnabled(Level.WARN)) {
doLogf(Level.WARN, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a formatted log message with a level of WARN.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void warnf(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.WARN)) {
doLogf(Level.WARN, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a formatted log message with a level of WARN.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param params the parameters
*/
public void warnf(Throwable t, String format, Object... params) {
doLogf(Level.WARN, FQCN, format, params, t);
}
/**
* Issue a formatted log message with a level of WARN.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the sole parameter
*/
public void warnf(Throwable t, String format, Object param1) {
if (isEnabled(Level.WARN)) {
doLogf(Level.WARN, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a formatted log message with a level of WARN.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void warnf(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.WARN)) {
doLogf(Level.WARN, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a formatted log message with a level of WARN.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void warnf(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.WARN)) {
doLogf(Level.WARN, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a log message with a level of ERROR.
*
* @param message the message
*/
public void error(Object message) {
doLog(Level.ERROR, FQCN, message, null, null);
}
/**
* Issue a log message and throwable with a level of ERROR.
*
* @param message the message
* @param t the throwable
*/
public void error(Object message, Throwable t) {
doLog(Level.ERROR, FQCN, message, null, t);
}
/**
* Issue a log message and throwable with a level of ERROR and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param t the throwable
*/
public void error(String loggerFqcn, Object message, Throwable t) {
doLog(Level.ERROR, loggerFqcn, message, null, t);
}
/**
* Issue a log message with parameters with a level of ERROR.
*
* @param message the message
* @param params the message parameters
* @deprecated To log a message with parameters, using {@link #errorv(String, Object...)} is recommended.
*/
@Deprecated
public void error(Object message, Object[] params) {
doLog(Level.ERROR, FQCN, message, params, null);
}
/**
* Issue a log message with parameters and a throwable with a level of ERROR.
*
* @param message the message
* @param params the message parameters
* @param t the throwable
* @deprecated To log a message with parameters, using {@link #errorv(Throwable, String, Object...)} is recommended.
*/
@Deprecated
public void error(Object message, Object[] params, Throwable t) {
doLog(Level.ERROR, FQCN, message, params, t);
}
/**
* Issue a log message with parameters and a throwable with a level of ERROR.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param params the message parameters
* @param t the throwable
*/
public void error(String loggerFqcn, Object message, Object[] params, Throwable t) {
doLog(Level.ERROR, loggerFqcn, message, params, t);
}
/**
* Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param params the parameters
*/
public void errorv(String format, Object... params) {
doLog(Level.ERROR, FQCN, format, params, null);
}
/**
* Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the sole parameter
*/
public void errorv(String format, Object param1) {
if (isEnabled(Level.ERROR)) {
doLog(Level.ERROR, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void errorv(String format, Object param1, Object param2) {
if (isEnabled(Level.ERROR)) {
doLog(Level.ERROR, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void errorv(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.ERROR)) {
doLog(Level.ERROR, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param params the parameters
*/
public void errorv(Throwable t, String format, Object... params) {
doLog(Level.ERROR, FQCN, format, params, t);
}
/**
* Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the sole parameter
*/
public void errorv(Throwable t, String format, Object param1) {
if (isEnabled(Level.ERROR)) {
doLog(Level.ERROR, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void errorv(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.ERROR)) {
doLog(Level.ERROR, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void errorv(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.ERROR)) {
doLog(Level.ERROR, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a formatted log message with a level of ERROR.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param params the parameters
*/
public void errorf(String format, Object... params) {
doLogf(Level.ERROR, FQCN, format, params, null);
}
/**
* Issue a formatted log message with a level of ERROR.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the sole parameter
*/
public void errorf(String format, Object param1) {
if (isEnabled(Level.ERROR)) {
doLogf(Level.ERROR, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a formatted log message with a level of ERROR.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void errorf(String format, Object param1, Object param2) {
if (isEnabled(Level.ERROR)) {
doLogf(Level.ERROR, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a formatted log message with a level of ERROR.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void errorf(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.ERROR)) {
doLogf(Level.ERROR, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a formatted log message with a level of ERROR.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param params the parameters
*/
public void errorf(Throwable t, String format, Object... params) {
doLogf(Level.ERROR, FQCN, format, params, t);
}
/**
* Issue a formatted log message with a level of ERROR.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the sole parameter
*/
public void errorf(Throwable t, String format, Object param1) {
if (isEnabled(Level.ERROR)) {
doLogf(Level.ERROR, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a formatted log message with a level of ERROR.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void errorf(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.ERROR)) {
doLogf(Level.ERROR, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a formatted log message with a level of ERROR.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void errorf(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.ERROR)) {
doLogf(Level.ERROR, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a log message with a level of FATAL.
*
* @param message the message
*/
public void fatal(Object message) {
doLog(Level.FATAL, FQCN, message, null, null);
}
/**
* Issue a log message and throwable with a level of FATAL.
*
* @param message the message
* @param t the throwable
*/
public void fatal(Object message, Throwable t) {
doLog(Level.FATAL, FQCN, message, null, t);
}
/**
* Issue a log message and throwable with a level of FATAL and a specific logger class name.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param t the throwable
*/
public void fatal(String loggerFqcn, Object message, Throwable t) {
doLog(Level.FATAL, loggerFqcn, message, null, t);
}
/**
* Issue a log message with parameters with a level of FATAL.
*
* @param message the message
* @param params the message parameters
* @deprecated To log a message with parameters, using {@link #fatalv(String, Object...)} is recommended.
*/
@Deprecated
public void fatal(Object message, Object[] params) {
doLog(Level.FATAL, FQCN, message, params, null);
}
/**
* Issue a log message with parameters and a throwable with a level of FATAL.
*
* @param message the message
* @param params the message parameters
* @param t the throwable
* @deprecated To log a message with parameters, using {@link #fatalv(Throwable, String, Object...)} is recommended.
*/
@Deprecated
public void fatal(Object message, Object[] params, Throwable t) {
doLog(Level.FATAL, FQCN, message, params, t);
}
/**
* Issue a log message with parameters and a throwable with a level of FATAL.
*
* @param loggerFqcn the logger class name
* @param message the message
* @param params the message parameters
* @param t the throwable
*/
public void fatal(String loggerFqcn, Object message, Object[] params, Throwable t) {
doLog(Level.FATAL, loggerFqcn, message, params, t);
}
/**
* Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param params the parameters
*/
public void fatalv(String format, Object... params) {
doLog(Level.FATAL, FQCN, format, params, null);
}
/**
* Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the sole parameter
*/
public void fatalv(String format, Object param1) {
if (isEnabled(Level.FATAL)) {
doLog(Level.FATAL, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void fatalv(String format, Object param1, Object param2) {
if (isEnabled(Level.FATAL)) {
doLog(Level.FATAL, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting.
*
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void fatalv(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.FATAL)) {
doLog(Level.FATAL, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param params the parameters
*/
public void fatalv(Throwable t, String format, Object... params) {
doLog(Level.FATAL, FQCN, format, params, t);
}
/**
* Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the sole parameter
*/
public void fatalv(Throwable t, String format, Object param1) {
if (isEnabled(Level.FATAL)) {
doLog(Level.FATAL, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void fatalv(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.FATAL)) {
doLog(Level.FATAL, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a log message with a level of FATAL using {@link java.text.MessageFormat}-style formatting.
*
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void fatalv(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.FATAL)) {
doLog(Level.FATAL, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a formatted log message with a level of FATAL.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param params the parameters
*/
public void fatalf(String format, Object... params) {
doLogf(Level.FATAL, FQCN, format, params, null);
}
/**
* Issue a formatted log message with a level of FATAL.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the sole parameter
*/
public void fatalf(String format, Object param1) {
if (isEnabled(Level.FATAL)) {
doLogf(Level.FATAL, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a formatted log message with a level of FATAL.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void fatalf(String format, Object param1, Object param2) {
if (isEnabled(Level.FATAL)) {
doLogf(Level.FATAL, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a formatted log message with a level of FATAL.
*
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void fatalf(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.FATAL)) {
doLogf(Level.FATAL, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a formatted log message with a level of FATAL.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param params the parameters
*/
public void fatalf(Throwable t, String format, Object... params) {
doLogf(Level.FATAL, FQCN, format, params, t);
}
/**
* Issue a formatted log message with a level of FATAL.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the sole parameter
*/
public void fatalf(Throwable t, String format, Object param1) {
if (isEnabled(Level.FATAL)) {
doLogf(Level.FATAL, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a formatted log message with a level of FATAL.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void fatalf(Throwable t, String format, Object param1, Object param2) {
if (isEnabled(Level.FATAL)) {
doLogf(Level.FATAL, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a formatted log message with a level of FATAL.
*
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void fatalf(Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.FATAL)) {
doLogf(Level.FATAL, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Log a message at the given level.
*
* @param level the level
* @param message the message
*/
public void log(Level level, Object message) {
doLog(level, FQCN, message, null, null);
}
/**
* Issue a log message and throwable at the given log level.
*
* @param level the level
* @param message the message
* @param t the throwable
*/
public void log(Level level, Object message, Throwable t) {
doLog(level, FQCN, message, null, t);
}
/**
* Issue a log message and throwable at the given log level and a specific logger class name.
*
* @param level the level
* @param loggerFqcn the logger class name
* @param message the message
* @param t the throwable
*/
public void log(Level level, String loggerFqcn, Object message, Throwable t) {
doLog(level, loggerFqcn, message, null, t);
}
/**
* Issue a log message with parameters at the given log level.
*
* @param level the level
* @param message the message
* @param params the message parameters
* @deprecated To log a message with parameters, using {@link #logv(Level, String, Object...)} is recommended.
*/
@Deprecated
public void log(Level level, Object message, Object[] params) {
doLog(level, FQCN, message, params, null);
}
/**
* Issue a log message with parameters and a throwable at the given log level.
*
* @param level the level
* @param message the message
* @param params the message parameters
* @param t the throwable
* @deprecated To log a message with parameters, using {@link #logv(Level, Throwable, String, Object...)} is recommended.
*/
@Deprecated
public void log(Level level, Object message, Object[] params, Throwable t) {
doLog(level, FQCN, message, params, t);
}
/**
* Issue a log message with parameters and a throwable at the given log level.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param message the message
* @param params the message parameters
* @param t the throwable
*/
public void log(String loggerFqcn, Level level, Object message, Object[] params, Throwable t) {
doLog(level, loggerFqcn, message, params, t);
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param level the level
* @param format the message format string
* @param params the parameters
*/
public void logv(Level level, String format, Object... params) {
doLog(level, FQCN, format, params, null);
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param level the level
* @param format the message format string
* @param param1 the sole parameter
*/
public void logv(Level level, String format, Object param1) {
if (isEnabled(level)) {
doLog(level, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param level the level
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void logv(Level level, String format, Object param1, Object param2) {
if (isEnabled(level)) {
doLog(level, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param level the level
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void logv(Level level, String format, Object param1, Object param2, Object param3) {
if (isEnabled(level)) {
doLog(level, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param level the level
* @param t the throwable
* @param format the message format string
* @param params the parameters
*/
public void logv(Level level, Throwable t, String format, Object... params) {
doLog(level, FQCN, format, params, t);
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param level the level
* @param t the throwable
* @param format the message format string
* @param param1 the sole parameter
*/
public void logv(Level level, Throwable t, String format, Object param1) {
if (isEnabled(level)) {
doLog(level, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param level the level
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void logv(Level level, Throwable t, String format, Object param1, Object param2) {
if (isEnabled(level)) {
doLog(level, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param level the level
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void logv(Level level, Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(level)) {
doLog(level, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param t the throwable
* @param format the message format string
* @param params the parameters
*/
public void logv(String loggerFqcn, Level level, Throwable t, String format, Object... params) {
doLog(level, loggerFqcn, format, params, t);
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param t the throwable
* @param format the message format string
* @param param1 the sole parameter
*/
public void logv(String loggerFqcn, Level level, Throwable t, String format, Object param1) {
if (isEnabled(level)) {
doLog(level, loggerFqcn, format, new Object[] { param1 }, t);
}
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void logv(String loggerFqcn, Level level, Throwable t, String format, Object param1, Object param2) {
if (isEnabled(level)) {
doLog(level, loggerFqcn, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a log message at the given log level using {@link java.text.MessageFormat}-style formatting.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param t the throwable
* @param format the message format string
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void logv(String loggerFqcn, Level level, Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(level)) {
doLog(level, loggerFqcn, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Issue a formatted log message at the given log level.
*
* @param level the level
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param params the parameters
*/
public void logf(Level level, String format, Object... params) {
doLogf(level, FQCN, format, params, null);
}
/**
* Issue a formatted log message at the given log level.
*
* @param level the level
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the sole parameter
*/
public void logf(Level level, String format, Object param1) {
if (isEnabled(level)) {
doLogf(level, FQCN, format, new Object[] { param1 }, null);
}
}
/**
* Issue a formatted log message at the given log level.
*
* @param level the level
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void logf(Level level, String format, Object param1, Object param2) {
if (isEnabled(level)) {
doLogf(level, FQCN, format, new Object[] { param1, param2 }, null);
}
}
/**
* Issue a formatted log message at the given log level.
*
* @param level the level
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void logf(Level level, String format, Object param1, Object param2, Object param3) {
if (isEnabled(level)) {
doLogf(level, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
}
/**
* Issue a formatted log message at the given log level.
*
* @param level the level
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param params the parameters
*/
public void logf(Level level, Throwable t, String format, Object... params) {
doLogf(level, FQCN, format, params, t);
}
/**
* Issue a formatted log message at the given log level.
*
* @param level the level
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the sole parameter
*/
public void logf(Level level, Throwable t, String format, Object param1) {
if (isEnabled(level)) {
doLogf(level, FQCN, format, new Object[] { param1 }, t);
}
}
/**
* Issue a formatted log message at the given log level.
*
* @param level the level
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void logf(Level level, Throwable t, String format, Object param1, Object param2) {
if (isEnabled(level)) {
doLogf(level, FQCN, format, new Object[] { param1, param2 }, t);
}
}
/**
* Issue a formatted log message at the given log level.
*
* @param level the level
* @param t the throwable
* @param format the format string, as per {@link String#format(String, Object...)}
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void logf(Level level, Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(level)) {
doLogf(level, FQCN, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Log a message at the given level.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param t the throwable cause
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the sole parameter
*/
public void logf(String loggerFqcn, Level level, Throwable t, String format, Object param1) {
if (isEnabled(level)) {
doLogf(level, loggerFqcn, format, new Object[] { param1 }, t);
}
}
/**
* Log a message at the given level.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param t the throwable cause
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
*/
public void logf(String loggerFqcn, Level level, Throwable t, String format, Object param1, Object param2) {
if (isEnabled(level)) {
doLogf(level, loggerFqcn, format, new Object[] { param1, param2 }, t);
}
}
/**
* Log a message at the given level.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param t the throwable cause
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param param1 the first parameter
* @param param2 the second parameter
* @param param3 the third parameter
*/
public void logf(String loggerFqcn, Level level, Throwable t, String format, Object param1, Object param2, Object param3) {
if (isEnabled(level)) {
doLogf(level, loggerFqcn, format, new Object[] { param1, param2, param3 }, t);
}
}
/**
* Log a message at the given level.
*
* @param loggerFqcn the logger class name
* @param level the level
* @param t the throwable cause
* @param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
* @param params the message parameters
*/
public void logf(String loggerFqcn, Level level, Throwable t, String format, Object... params) {
doLogf(level, loggerFqcn, format, params, t);
}
/**
* Read resolver; replaces deserialized instance with a canonical instance.
*
* @return the canonical logger instance
*/
protected final Object writeReplace() {
return new SerializedLogger(name);
}
/**
* Get a Logger instance given the logger name.
*
* @param name the logger name
*
* @return the logger
*/
public static Logger getLogger(String name) {
return LoggerProviders.PROVIDER.getLogger(name);
}
/**
* Get a Logger instance given the logger name with the given suffix.
*
* This will include a logger separator between logger name and suffix.
*
* @param name the logger name
* @param suffix a suffix to append to the logger name
*
* @return the logger
*/
public static Logger getLogger(String name, String suffix) {
return getLogger(name == null || name.length() == 0 ? suffix : name + "." + suffix);
}
/**
* Get a Logger instance given the name of a class. This simply calls create(clazz.getName()).
*
* @param clazz the Class whose name will be used as the logger name
*
* @return the logger
*/
public static Logger getLogger(Class> clazz) {
return getLogger(clazz.getName());
}
/**
* Get a Logger instance given the name of a class with the given suffix.
*
* This will include a logger separator between logger name and suffix
*
* @param clazz the Class whose name will be used as the logger name
* @param suffix a suffix to append to the logger name
*
* @return the logger
*/
public static Logger getLogger(Class> clazz, String suffix) {
return getLogger(clazz.getName(), suffix);
}
/**
* Get a typed logger which implements the given interface. The current default locale will be used for the new logger.
*
* @param type the interface to implement
* @param category the logger category
* @param the logger type
* @return the typed logger
*/
public static T getMessageLogger(Class type, String category) {
return getMessageLogger(type, category, LoggingLocale.getLocale());
}
/**
* Get a typed logger which implements the given interface. The given locale will be used for the new logger.
*
* @param type the interface to implement
* @param category the logger category
* @param locale the locale for the new logger
* @param the logger type
* @return the typed logger
*/
public static T getMessageLogger(final Class type, final String category, final Locale locale) {
if (System.getSecurityManager() == null)
return doGetMessageLogger(type, category, locale);
return doPrivileged(new PrivilegedAction() {
public T run() {
return doGetMessageLogger(type, category, locale);
}
});
}
private static T doGetMessageLogger(final Class type, final String category, final Locale locale) {
String language = locale.getLanguage();
String country = locale.getCountry();
String variant = locale.getVariant();
Class extends T> loggerClass = null;
final ClassLoader classLoader = type.getClassLoader();
final String typeName = type.getName();
if (variant != null && variant.length() > 0) try {
loggerClass = Class.forName(join(typeName, "$logger", language, country, variant), true, classLoader).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (loggerClass == null && country != null && country.length() > 0) try {
loggerClass = Class.forName(join(typeName, "$logger", language, country, null), true, classLoader).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (loggerClass == null && language != null && language.length() > 0) try {
loggerClass = Class.forName(join(typeName, "$logger", language, null, null), true, classLoader).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (loggerClass == null) try {
loggerClass = Class.forName(join(typeName, "$logger", null, null, null), true, classLoader).asSubclass(type);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Invalid logger " + type + " (implementation not found in " + classLoader + ")");
}
final Constructor extends T> constructor;
try {
constructor = loggerClass.getConstructor(Logger.class);
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException("Logger implementation " + loggerClass + " has no matching constructor");
}
try {
return constructor.newInstance(Logger.getLogger(category));
} catch (InstantiationException e) {
throw new IllegalArgumentException("Logger implementation " + loggerClass + " could not be instantiated", e);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Logger implementation " + loggerClass + " could not be instantiated", e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException("Logger implementation " + loggerClass + " could not be instantiated", e.getCause());
}
}
private static String join(String interfaceName, String a, String b, String c, String d) {
final StringBuilder build = new StringBuilder();
build.append(interfaceName).append('_').append(a);
if (b != null && b.length() > 0) {
build.append('_');
build.append(b);
}
if (c != null && c.length() > 0) {
build.append('_');
build.append(c);
}
if (d != null && d.length() > 0) {
build.append('_');
build.append(d);
}
return build.toString();
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/LoggerProvider.java 0000664 0000000 0000000 00000006600 14167375145 0027122 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.Collections;
import java.util.Map;
/**
* A contract for the log provider implementation.
*/
public interface LoggerProvider {
/**
* Returns a logger which is backed by a logger from the log provider.
*
*
* Note: this should never be {@code null}
*
*
* @param name the name of the logger
*
* @return a logger for the log provider logger.
*/
Logger getLogger(String name);
/**
* Removes all entries from the message diagnostics context.
*/
void clearMdc();
/**
* Puts the value onto the message diagnostics context.
*
* @param key the key for the value
* @param value the value
*
* @return the previous value set or {@code null} if no value was set
*/
Object putMdc(String key, Object value);
/**
* Returns the value for the key on the message diagnostics context or {@code null} if no value was found.
*
* @param key the key to lookup the value for
*
* @return the value or {@code null} if not found
*/
Object getMdc(String key);
/**
* Removes the value from the message diagnostics context.
*
* @param key the key of the value to remove
*/
void removeMdc(String key);
/**
* Returns the map from the context.
*
*
* Note that in most implementations this is an expensive operation and should be used sparingly.
*
*
* @return the map from the context or an {@linkplain Collections#emptyMap() empty map} if the context is {@code
* null}
*/
Map getMdcMap();
/**
* Clears the nested diagnostics context.
*/
void clearNdc();
/**
* Retrieves the current values set for the nested diagnostics context.
*
* @return the current value set or {@code null} if no value was set
*/
String getNdc();
/**
* The current depth of the nested diagnostics context.
*
* @return the current depth of the stack
*/
int getNdcDepth();
/**
* Pops top value from the stack and returns it.
*
* @return the top value from the stack or an empty string if no value was set
*/
String popNdc();
/**
* Peeks at the top value from the stack and returns it.
*
* @return the value or an empty string
*/
String peekNdc();
/**
* Pushes a value to the nested diagnostics context stack.
*
* @param message the message to push
*/
void pushNdc(String message);
/**
* Sets maximum depth of the stack removing any entries below the maximum depth.
*
* @param maxDepth the maximum depth to set
*/
void setNdcMaxDepth(int maxDepth);
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/LoggerProviders.java 0000664 0000000 0000000 00000015170 14167375145 0027307 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2011 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.Iterator;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.logging.LogManager;
final class LoggerProviders {
static final String LOGGING_PROVIDER_KEY = "org.jboss.logging.provider";
static final LoggerProvider PROVIDER = find();
private static LoggerProvider find() {
return findProvider();
}
private static LoggerProvider findProvider() {
// Since the impl classes refer to the back-end frameworks directly, if this classloader can't find the target
// log classes, then it doesn't really matter if they're possibly available from the TCCL because we won't be
// able to find it anyway
final ClassLoader cl = LoggerProviders.class.getClassLoader();
try {
// Check the system property
final String loggerProvider = SecurityActions.getSystemProperty(LOGGING_PROVIDER_KEY);
if (loggerProvider != null) {
if ("jboss".equalsIgnoreCase(loggerProvider)) {
return tryJBossLogManager(cl, "system property");
} else if ("jdk".equalsIgnoreCase(loggerProvider)) {
return tryJDK("system property");
} else if ("log4j2".equalsIgnoreCase(loggerProvider)) {
return tryLog4j2(cl, "system property");
} else if ("log4j".equalsIgnoreCase(loggerProvider)) {
return tryLog4j(cl, "system property");
} else if ("slf4j".equalsIgnoreCase(loggerProvider)) {
return trySlf4j("system property");
}
}
} catch (Throwable t) {
// nope...
}
// Next try for a service provider
try {
final ServiceLoader loader = ServiceLoader.load(LoggerProvider.class, cl);
final Iterator iter = loader.iterator();
for (; ; )
try {
if (!iter.hasNext()) break;
LoggerProvider provider = iter.next();
// Attempt to get a logger, if it fails keep trying
logProvider(provider, "service loader");
return provider;
} catch (ServiceConfigurationError ignore) {
}
} catch (Throwable ignore) {
// TODO consider printing the stack trace as it should only happen once
}
// Finally search the class path
try {
return tryJBossLogManager(cl, null);
} catch (Throwable t) {
// nope...
}
try {
// MUST try Log4j 2.x BEFORE Log4j 1.x because Log4j 2.x also passes Log4j 1.x test in some circumstances
return tryLog4j2(cl, null);
} catch (Throwable t) {
// nope...
}
try {
return tryLog4j(cl, null);
} catch (Throwable t) {
// nope...
}
try {
// only use slf4j if Logback is in use
Class.forName("ch.qos.logback.classic.Logger", false, cl);
return trySlf4j(null);
} catch (Throwable t) {
// nope...
}
return tryJDK(null);
}
private static JDKLoggerProvider tryJDK(final String via) {
final JDKLoggerProvider provider = new JDKLoggerProvider();
logProvider(provider, via);
return provider;
}
private static LoggerProvider trySlf4j(final String via) {
final LoggerProvider provider = new Slf4jLoggerProvider();
logProvider(provider, via);
return provider;
}
// JBLOGGING-95 - Add support for Log4j 2.x
private static LoggerProvider tryLog4j2(final ClassLoader cl, final String via) throws ClassNotFoundException {
Class.forName("org.apache.logging.log4j.Logger", true, cl);
Class.forName("org.apache.logging.log4j.LogManager", true, cl);
Class.forName("org.apache.logging.log4j.spi.AbstractLogger", true, cl);
LoggerProvider provider = new Log4j2LoggerProvider();
// if Log4j 2 has a bad implementation that doesn't extend AbstractLogger, we won't know until getting the first logger throws an exception
logProvider(provider, via);
return provider;
}
private static LoggerProvider tryLog4j(final ClassLoader cl, final String via) throws ClassNotFoundException {
Class.forName("org.apache.log4j.LogManager", true, cl);
// JBLOGGING-65 - slf4j can disguise itself as log4j. Test for a class that slf4j doesn't provide.
// JBLOGGING-94 - JBoss Logging does not detect org.apache.logging.log4j:log4j-1.2-api:2.0
Class.forName("org.apache.log4j.config.PropertySetter", true, cl);
final LoggerProvider provider = new Log4jLoggerProvider();
logProvider(provider, via);
return provider;
}
private static LoggerProvider tryJBossLogManager(final ClassLoader cl, final String via) throws ClassNotFoundException {
final Class extends LogManager> logManagerClass = LogManager.getLogManager().getClass();
if (logManagerClass == Class.forName("org.jboss.logmanager.LogManager", false, cl)
&& Class.forName("org.jboss.logmanager.Logger$AttachmentKey", true, cl).getClassLoader() == logManagerClass.getClassLoader()) {
final LoggerProvider provider = new JBossLogManagerProvider();
logProvider(provider, via);
return provider;
}
throw new IllegalStateException();
}
private static void logProvider(final LoggerProvider provider, final String via) {
// Log a debug message indicating which logger we are using
final Logger logger = provider.getLogger("org.jboss.logging");
if (via == null) {
logger.debugf("Logging Provider: %s", provider.getClass().getName());
} else {
logger.debugf("Logging Provider: %s found via %s", provider.getClass().getName(), via);
}
}
private LoggerProviders() {
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/LoggingLocale.java 0000664 0000000 0000000 00000014422 14167375145 0026677 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2017 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.Locale;
/**
* A simple utility to resolve the default locale to use for internationalized loggers and message bundles.
*
* @author James R. Perkins
*/
@SuppressWarnings("SameParameterValue")
class LoggingLocale {
private static final Locale LOCALE = getDefaultLocale();
/**
* Attempts to create a {@link Locale} based on the {@code org.jboss.logging.locale} system property. If the value
* is not defined the {@linkplain Locale#getDefault() default locale} will be used.
*
* The value should be in the BCP 47 format.
*
*
* Note: Currently this uses a custom parser to attempt to parse the BCP 47 format. This will be
* changed to use the {@code Locale.forLanguageTag()} once a move to JDK 7. Currently only the language, region and
* variant are used to construct the locale.
*
*
* @return the locale created or the default locale
*/
static Locale getLocale() {
return LOCALE;
}
private static Locale getDefaultLocale() {
final String bcp47Tag = SecurityActions.getSystemProperty("org.jboss.logging.locale", "");
if (bcp47Tag.trim().isEmpty()) {
return Locale.getDefault();
}
// When we upgrade to Java 7 we can use the Locale.forLanguageTag(locale) which will reliably parse the
// the value. For now we have to attempt to parse it the best we can.
return forLanguageTag(bcp47Tag);
}
private static Locale forLanguageTag(final String locale) {
// First check known locales
if ("en-CA".equalsIgnoreCase(locale)) {
return Locale.CANADA;
} else if ("fr-CA".equalsIgnoreCase(locale)) {
return Locale.CANADA_FRENCH;
} else if ("zh".equalsIgnoreCase(locale)) {
return Locale.CHINESE;
} else if ("en".equalsIgnoreCase(locale)) {
return Locale.ENGLISH;
} else if ("fr-FR".equalsIgnoreCase(locale)) {
return Locale.FRANCE;
} else if ("fr".equalsIgnoreCase(locale)) {
return Locale.FRENCH;
} else if ("de".equalsIgnoreCase(locale)) {
return Locale.GERMAN;
} else if ("de-DE".equalsIgnoreCase(locale)) {
return Locale.GERMANY;
} else if ("it".equalsIgnoreCase(locale)) {
return Locale.ITALIAN;
} else if ("it-IT".equalsIgnoreCase(locale)) {
return Locale.ITALY;
} else if ("ja-JP".equalsIgnoreCase(locale)) {
return Locale.JAPAN;
} else if ("ja".equalsIgnoreCase(locale)) {
return Locale.JAPANESE;
} else if ("ko-KR".equalsIgnoreCase(locale)) {
return Locale.KOREA;
} else if ("ko".equalsIgnoreCase(locale)) {
return Locale.KOREAN;
} else if ("zh-CN".equalsIgnoreCase(locale)) {
return Locale.SIMPLIFIED_CHINESE;
} else if ("zh-TW".equalsIgnoreCase(locale)) {
return Locale.TRADITIONAL_CHINESE;
} else if ("en-UK".equalsIgnoreCase(locale)) {
return Locale.UK;
} else if ("en-US".equalsIgnoreCase(locale)) {
return Locale.US;
}
// Split the string into parts and attempt
final String[] parts = locale.split("-");
final int len = parts.length;
int index = 0;
int count = 0;
final String language = parts[index++];
String region = ""; // country
String variant = "";
// The next 3 sections may be extended languages, we're just going to ignore them
while (index < len) {
if (count++ == 2 || !isAlpha(parts[index], 3, 3)) {
break;
}
index++;
}
// Check for a script, we'll skip it however a script is not supported until Java 7
if (index != len && isAlpha(parts[index], 4, 4)) {
index++;
}
// Next should be the region, 3 digit is allowed but may not work with Java 6
if (index != len && (isAlpha(parts[index], 2, 2) || isNumeric(parts[index], 3, 3))) {
region = parts[index++];
}
// Next should be the variant and we will just use the first one found, all other parts will be ignored
if (index != len && (isAlphaOrNumeric(parts[index], 5, 8))) {
variant = parts[index];
}
return new Locale(language, region, variant);
}
private static boolean isAlpha(final String value, final int minLen, final int maxLen) {
final int len = value.length();
if (len < minLen || len > maxLen) {
return false;
}
for (int i = 0; i < len; i++) {
if (!Character.isLetter(value.charAt(i))) {
return false;
}
}
return true;
}
private static boolean isNumeric(final String value, final int minLen, final int maxLen) {
final int len = value.length();
if (len < minLen || len > maxLen) {
return false;
}
for (int i = 0; i < len; i++) {
if (!Character.isDigit(value.charAt(i))) {
return false;
}
}
return true;
}
private static boolean isAlphaOrNumeric(final String value, final int minLen, final int maxLen) {
final int len = value.length();
if (len < minLen || len > maxLen) {
return false;
}
for (int i = 0; i < len; i++) {
if (!Character.isLetterOrDigit(value.charAt(i))) {
return false;
}
}
return true;
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/MDC.java 0000664 0000000 0000000 00000004414 14167375145 0024574 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.Collections;
import java.util.Map;
/**
* Mapped diagnostic context. Each log provider implementation may behave different.
*/
public final class MDC {
private MDC() {
}
/**
* Puts the value onto the context.
*
* @param key the key for the value
* @param val the value
*
* @return the previous value set or {@code null} if no value was set
*/
public static Object put(String key, Object val) {
return LoggerProviders.PROVIDER.putMdc(key, val);
}
/**
* Returns the value for the key or {@code null} if no value was found.
*
* @param key the key to lookup the value for
*
* @return the value or {@code null} if not found
*/
public static Object get(String key) {
return LoggerProviders.PROVIDER.getMdc(key);
}
/**
* Removes the value from the context.
*
* @param key the key of the value to remove
*/
public static void remove(String key) {
LoggerProviders.PROVIDER.removeMdc(key);
}
/**
* Returns the map from the context.
*
*
* Note that in most implementations this is an expensive operation and should be used sparingly.
*
*
* @return the map from the context or an {@linkplain Collections#emptyMap() empty map} if the context is {@code
* null}
*/
public static Map getMap() {
return LoggerProviders.PROVIDER.getMdcMap();
}
/**
* Clears the message diagnostics context.
*/
public static void clear() {
LoggerProviders.PROVIDER.clearMdc();
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/Messages.java 0000664 0000000 0000000 00000011075 14167375145 0025741 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.lang.reflect.Field;
import java.security.PrivilegedAction;
import java.util.Locale;
import static java.security.AccessController.doPrivileged;
/**
* A factory class to produce message bundle implementations.
*
* @author David M. Lloyd
*/
public final class Messages {
private Messages() {
}
/**
* Get a message bundle of the given type. Equivalent to {@link #getBundle(Class, java.util.Locale) getBundle}(type, Locale.getDefault())
.
*
* @param type the bundle type class
* @param the bundle type
* @return the bundle
*/
public static T getBundle(Class type) {
return getBundle(type, LoggingLocale.getLocale());
}
/**
* Get a message bundle of the given type.
*
* @param type the bundle type class
* @param locale the message locale to use
* @param the bundle type
* @return the bundle
*/
public static T getBundle(final Class type, final Locale locale) {
if (System.getSecurityManager() == null) {
return doGetBundle(type, locale);
}
return doPrivileged(new PrivilegedAction() {
public T run() {
return doGetBundle(type, locale);
}
});
}
private static T doGetBundle(final Class type, final Locale locale) {
String language = locale.getLanguage();
String country = locale.getCountry();
String variant = locale.getVariant();
Class extends T> bundleClass = null;
if (variant != null && variant.length() > 0) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", language, country, variant), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null && country != null && country.length() > 0) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", language, country, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null && language != null && language.length() > 0) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", language, null, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", null, null, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Invalid bundle " + type + " (implementation not found)");
}
final Field field;
try {
field = bundleClass.getField("INSTANCE");
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("Bundle implementation " + bundleClass + " has no instance field");
}
try {
return type.cast(field.get(null));
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Bundle implementation " + bundleClass + " could not be instantiated", e);
}
}
private static String join(String interfaceName, String a, String b, String c, String d) {
final StringBuilder build = new StringBuilder();
build.append(interfaceName).append('_').append(a);
if (b != null && b.length() > 0) {
build.append('_');
build.append(b);
}
if (c != null && c.length() > 0) {
build.append('_');
build.append(c);
}
if (d != null && d.length() > 0) {
build.append('_');
build.append(d);
}
return build.toString();
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/NDC.java 0000664 0000000 0000000 00000004440 14167375145 0024574 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
public final class NDC {
private NDC() {
}
/**
* Clears the nested diagnostics context.
*/
public static void clear() {
LoggerProviders.PROVIDER.clearNdc();
}
/**
* Retrieves the current values set for the nested diagnostics context.
*
* @return the current value set or {@code null} if no value was set
*/
public static String get() {
return LoggerProviders.PROVIDER.getNdc();
}
/**
* The current depth of the nested diagnostics context.
*
* @return the current depth of the stack
*/
public static int getDepth() {
return LoggerProviders.PROVIDER.getNdcDepth();
}
/**
* Pops top value from the stack and returns it.
*
* @return the top value from the stack or an empty string if no value was set
*/
public static String pop() {
return LoggerProviders.PROVIDER.popNdc();
}
/**
* Peeks at the top value from the stack and returns it.
*
* @return the value or an empty string
*/
public static String peek() {
return LoggerProviders.PROVIDER.peekNdc();
}
/**
* Pushes a value to the nested diagnostics context stack.
*
* @param message the message to push
*/
public static void push(String message) {
LoggerProviders.PROVIDER.pushNdc(message);
}
/**
* Sets maximum depth of the stack removing any entries below the maximum depth.
*
* @param maxDepth the maximum depth to set
*/
public static void setMaxDepth(int maxDepth) {
LoggerProviders.PROVIDER.setNdcMaxDepth(maxDepth);
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/ParameterConverter.java 0000664 0000000 0000000 00000003020 14167375145 0027771 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.Locale;
/**
* A converter for a specific parameter type.
*
* @author David M. Lloyd
* @param the input type
* @deprecated this is not currently used anywhere and no replacement will be created
*/
@Deprecated
public interface ParameterConverter {
/**
* Convert the parameter to its string or string-equivalent representation. The returned value will be passed in
* as a parameter to either a {@link java.text.MessageFormat} or {@link java.util.Formatter} instance, depending
* on the setting of {@code org.jboss.logging.annotation.Message.format}.
*
* @param locale the locale
* @param parameter the parameter
* @return the converted value
*/
Object convert(Locale locale, I parameter);
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/SecurityActions.java 0000664 0000000 0000000 00000003210 14167375145 0027312 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2019 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* @author James R. Perkins
*/
@SuppressWarnings("SameParameterValue")
class SecurityActions {
static String getSystemProperty(final String key) {
if (System.getSecurityManager() == null) {
return System.getProperty(key);
}
return AccessController.doPrivileged(new PrivilegedAction() {
@Override
public String run() {
return System.getProperty(key);
}
});
}
static String getSystemProperty(final String key, final String dft) {
if (System.getSecurityManager() == null) {
return System.getProperty(key, dft);
}
return AccessController.doPrivileged(new PrivilegedAction() {
@Override
public String run() {
return System.getProperty(key, dft);
}
});
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/SerializedLogger.java 0000664 0000000 0000000 00000001775 14167375145 0027433 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.io.Serializable;
final class SerializedLogger implements Serializable {
private static final long serialVersionUID = 508779982439435831L;
private final String name;
SerializedLogger(final String name) {
this.name = name;
}
protected Object readResolve() {
return Logger.getLogger(name);
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/Slf4jLocationAwareLogger.java 0000664 0000000 0000000 00000011024 14167375145 0030757 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;
import java.text.MessageFormat;
import org.slf4j.spi.LocationAwareLogger;
final class Slf4jLocationAwareLogger extends Logger {
private static final long serialVersionUID = 8685757928087758380L;
private static final Object[] EMPTY = new Object[0];
private static final boolean POST_1_6;
private static final Method LOG_METHOD;
static {
Method[] methods = LocationAwareLogger.class.getDeclaredMethods();
Method logMethod = null;
boolean post16 = false;
for (Method method : methods) {
if (method.getName().equals("log")) {
logMethod = method;
Class>[] parameterTypes = method.getParameterTypes();
post16 = parameterTypes.length == 6;
}
}
if (logMethod == null) {
throw new NoSuchMethodError("Cannot find LocationAwareLogger.log() method");
}
POST_1_6 = post16;
LOG_METHOD = logMethod;
}
private final LocationAwareLogger logger;
Slf4jLocationAwareLogger(final String name, final LocationAwareLogger logger) {
super(name);
this.logger = logger;
}
public boolean isEnabled(final Level level) {
if (level != null) switch (level) {
case FATAL: return logger.isErrorEnabled();
case ERROR: return logger.isErrorEnabled();
case WARN: return logger.isWarnEnabled();
case INFO: return logger.isInfoEnabled();
case DEBUG: return logger.isDebugEnabled();
case TRACE: return logger.isTraceEnabled();
}
return true;
}
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) {
if (isEnabled(level)) {
final String text = parameters == null || parameters.length == 0 ? String.valueOf(message) : MessageFormat.format(String.valueOf(message), parameters);
doLog(logger, loggerClassName, translate(level), text, thrown);
}
}
protected void doLogf(final Level level, final String loggerClassName, final String format, final Object[] parameters, final Throwable thrown) {
if (isEnabled(level)) {
final String text = parameters == null ? String.format(format) : String.format(format, parameters);
doLog(logger, loggerClassName, translate(level), text, thrown);
}
}
private static void doLog(LocationAwareLogger logger, String className, int level, String text, Throwable thrown) {
try {
if (POST_1_6) {
LOG_METHOD.invoke(logger, null, className, Integer.valueOf(level), text, EMPTY, thrown);
} else {
LOG_METHOD.invoke(logger, null, className, Integer.valueOf(level), text, thrown);
}
} catch (InvocationTargetException e) {
try {
throw e.getCause();
} catch (RuntimeException ex) {
throw ex;
} catch (Error er) {
throw er;
} catch (Throwable throwable) {
throw new UndeclaredThrowableException(throwable);
}
} catch (IllegalAccessException e) {
throw new IllegalAccessError(e.getMessage());
}
}
private static int translate(Level level) {
if (level != null) switch (level) {
case FATAL:
case ERROR: return LocationAwareLogger.ERROR_INT;
case WARN: return LocationAwareLogger.WARN_INT;
case INFO: return LocationAwareLogger.INFO_INT;
case DEBUG: return LocationAwareLogger.DEBUG_INT;
case TRACE: return LocationAwareLogger.TRACE_INT;
}
return LocationAwareLogger.TRACE_INT;
}
} jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/Slf4jLogger.java 0000664 0000000 0000000 00000006417 14167375145 0026320 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.text.MessageFormat;
final class Slf4jLogger extends Logger {
private static final long serialVersionUID = 8685757928087758380L;
private final org.slf4j.Logger logger;
Slf4jLogger(final String name, final org.slf4j.Logger logger) {
super(name);
this.logger = logger;
}
public boolean isEnabled(final Level level) {
if (level == Level.TRACE) {
return logger.isTraceEnabled();
} else if (level == Level.DEBUG) {
return logger.isDebugEnabled();
}
return infoOrHigherEnabled(level);
}
private boolean infoOrHigherEnabled(final Level level) {
if (level == Level.INFO) {
return logger.isInfoEnabled();
} else if (level == Level.WARN) {
return logger.isWarnEnabled();
} else if (level == Level.ERROR || level == Level.FATAL) {
return logger.isErrorEnabled();
}
return true;
}
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) {
if (isEnabled(level)) try {
final String text = parameters == null || parameters.length == 0 ? String.valueOf(message) : MessageFormat.format(String.valueOf(message), parameters);
if (level == Level.INFO) {
logger.info(text, thrown);
} else if (level == Level.WARN) {
logger.warn(text, thrown);
} else if (level == Level.ERROR || level == Level.FATAL) {
logger.error(text, thrown);
} else if (level == Level.DEBUG) {
logger.debug(text, thrown);
} else if (level == Level.TRACE) {
logger.debug(text, thrown);
}
} catch (Throwable ignored) {}
}
protected void doLogf(final Level level, final String loggerClassName, final String format, final Object[] parameters, final Throwable thrown) {
if (isEnabled(level)) try {
final String text = parameters == null ? String.format(format) : String.format(format, parameters);
if (level == Level.INFO) {
logger.info(text, thrown);
} else if (level == Level.WARN) {
logger.warn(text, thrown);
} else if (level == Level.ERROR || level == Level.FATAL) {
logger.error(text, thrown);
} else if (level == Level.DEBUG) {
logger.debug(text, thrown);
} else if (level == Level.TRACE) {
logger.debug(text, thrown);
}
} catch (Throwable ignored) {}
}
}
jboss-logging-3.4.3.Final/src/main/java/org/jboss/logging/Slf4jLoggerProvider.java 0000664 0000000 0000000 00000003677 14167375145 0030040 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2010 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.slf4j.spi.LocationAwareLogger;
final class Slf4jLoggerProvider extends AbstractLoggerProvider implements LoggerProvider {
public Logger getLogger(final String name) {
org.slf4j.Logger l = LoggerFactory.getLogger(name);
if (l instanceof LocationAwareLogger) {
return new Slf4jLocationAwareLogger(name, (LocationAwareLogger) l);
}
return new Slf4jLogger(name, l);
}
public void clearMdc() {
MDC.clear();
}
public Object putMdc(final String key, final Object value) {
try {
return MDC.get(key);
} finally {
if (value == null) {
MDC.remove(key);
} else {
MDC.put(key, String.valueOf(value));
}
}
}
public Object getMdc(final String key) {
return MDC.get(key);
}
public void removeMdc(final String key) {
MDC.remove(key);
}
@SuppressWarnings("unchecked")
public Map getMdcMap() {
final Map copy = MDC.getCopyOfContextMap();
return copy == null ? Collections.emptyMap() : new LinkedHashMap<>(copy);
}
}
jboss-logging-3.4.3.Final/src/main/resources/ 0000775 0000000 0000000 00000000000 14167375145 0021057 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/main/resources/META-INF/ 0000775 0000000 0000000 00000000000 14167375145 0022217 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/main/resources/META-INF/LICENSE.txt 0000664 0000000 0000000 00000026136 14167375145 0024052 0 ustar 00root root 0000000 0000000
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
jboss-logging-3.4.3.Final/src/test/ 0000775 0000000 0000000 00000000000 14167375145 0017100 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/test/java/ 0000775 0000000 0000000 00000000000 14167375145 0020021 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/test/java/org/ 0000775 0000000 0000000 00000000000 14167375145 0020610 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/test/java/org/jboss/ 0000775 0000000 0000000 00000000000 14167375145 0021730 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/ 0000775 0000000 0000000 00000000000 14167375145 0023356 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/AbstractClassPathTestCase.java 0000664 0000000 0000000 00000002117 14167375145 0031224 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* @author James R. Perkins
*/
abstract class AbstractClassPathTestCase {
@Test
public void testLogger() {
final Logger logger = Logger.getLogger(getClass());
Assertions.assertEquals(getLoggerClass(), logger.getClass());
}
abstract Class extends Logger> getLoggerClass();
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/AbstractLoggerTestCase.java 0000664 0000000 0000000 00000005027 14167375145 0030564 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* @author James R. Perkins
*/
abstract class AbstractLoggerTestCase {
@AfterAll
public static void clearProviderProperty() {
System.clearProperty("org.jboss.logging.provider");
}
@AfterEach
public void clearDiagnostics() {
MDC.clear();
NDC.clear();
}
@Test
public void testLogger() {
Assertions.assertEquals(getLoggerClass(), getLogger().getClass());
}
@Test
public void testLog() {
for (Logger.Level level : Logger.Level.values()) {
testLog(level);
}
}
@Test
public void testTrace() {
getLogger().trace("Test log level TRACE");
testLog("Test log level TRACE", Logger.Level.TRACE);
}
@Test
public void testDebug() {
getLogger().debug("Test log level DEBUG");
testLog("Test log level DEBUG", Logger.Level.DEBUG);
}
@Test
public void testInfo() {
getLogger().info("Test log level INFO");
testLog("Test log level INFO", Logger.Level.INFO);
}
@Test
public void testWarn() {
getLogger().warn("Test log level WARN");
testLog("Test log level WARN", Logger.Level.WARN);
}
@Test
public void testError() {
getLogger().error("Test log level ERROR");
testLog("Test log level ERROR", Logger.Level.ERROR);
}
@Test
public void testFatal() {
getLogger().fatal("Test log level FATAL");
testLog("Test log level FATAL", Logger.Level.FATAL);
}
abstract void testLog(Logger.Level level);
abstract void testLog(String msg, Logger.Level level);
abstract Logger getLogger();
abstract Class extends Logger> getLoggerClass();
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/CustomProviderTestCase.java 0000664 0000000 0000000 00000003745 14167375145 0030653 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* @author James R. Perkins
*/
public class CustomProviderTestCase {
@Test
public void testLogger() {
final Logger logger = Logger.getLogger(CustomProviderTestCase.class);
Assertions.assertEquals(TestLogger.class, logger.getClass());
}
public static class TestProvider extends AbstractMdcLoggerProvider implements LoggerProvider {
@Override
public Logger getLogger(final String name) {
return new TestLogger(name);
}
}
static class TestLogger extends Logger {
/**
* Construct a new instance.
*
* @param name the logger category name
*/
protected TestLogger(final String name) {
super(name);
}
@Override
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) {
}
@Override
protected void doLogf(final Level level, final String loggerClassName, final String format, final Object[] parameters, final Throwable thrown) {
}
@Override
public boolean isEnabled(final Level level) {
return true;
}
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/JBossLogManagerClassPathTestCase.java 0000664 0000000 0000000 00000001657 14167375145 0032446 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
/**
* @author James R. Perkins
*/
public class JBossLogManagerClassPathTestCase extends AbstractClassPathTestCase {
@Override
Class extends Logger> getLoggerClass() {
return JBossLogManagerLogger.class;
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/JBossLogManagerProviderTestCase.java 0000664 0000000 0000000 00000012352 14167375145 0032350 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import org.jboss.logmanager.LogContext;
import org.jboss.logmanager.LogContextSelector;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* @author James R. Perkins
*/
public class JBossLogManagerProviderTestCase extends AbstractLoggerTestCase {
private static final LogContextSelector DEFAULT_SELECTOR = LogContext.getLogContextSelector();
private static final AtomicBoolean SET_LOG_MANAGER = new AtomicBoolean(true);
private LogContext logContext;
private TestHandler handler;
private Logger logger;
@BeforeAll
public static void setup() {
SET_LOG_MANAGER.set(System.getProperty("java.util.logging.manager") == null);
if (SET_LOG_MANAGER.get()) {
System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
}
System.setProperty("org.jboss.logging.provider", "jboss");
}
@AfterAll
public static void tearDown() {
if (SET_LOG_MANAGER.get()) {
System.clearProperty("java.util.logging.manager");
}
}
@BeforeEach
public void setupLogContext() {
logContext = LogContext.create();
LogContext.setLogContextSelector(() -> logContext);
logger = Logger.getLogger(getClass());
handler = createHandler(logContext, logger.getName());
}
@AfterEach
public void closeLogContext() throws Exception {
logContext.close();
LogContext.setLogContextSelector(DEFAULT_SELECTOR);
}
@Test
public void testMdc() {
MDC.put("test.key", "value");
Assertions.assertEquals("value", MDC.get("test.key"));
Assertions.assertEquals("value", org.jboss.logmanager.MDC.get("test.key"));
}
@Test
public void testNdc() {
NDC.push("value1");
NDC.push("value2");
final String expectedValue = "value1.value2";
Assertions.assertEquals(expectedValue, NDC.peek());
Assertions.assertEquals(expectedValue, NDC.get());
Assertions.assertEquals(2, NDC.getDepth());
// Test the log manager values
Assertions.assertEquals(expectedValue, org.jboss.logmanager.NDC.get());
Assertions.assertEquals(2, org.jboss.logmanager.NDC.getDepth());
// Pop the stack
Assertions.assertEquals("value2", NDC.pop());
Assertions.assertEquals(1, NDC.getDepth());
Assertions.assertEquals("value1", NDC.get());
Assertions.assertEquals("value1", org.jboss.logmanager.NDC.get());
Assertions.assertEquals(1, org.jboss.logmanager.NDC.getDepth());
}
@Override
void testLog(final Logger.Level level) {
final String msg = String.format("Test log message at %s", level);
logger.log(level, msg);
Assertions.assertTrue(logger.isEnabled(level), String.format("Logger not enabled for level %s", level));
testLog(msg, level);
}
@Override
void testLog(final String msg, final Logger.Level level) {
final LogRecord logRecord = handler.queue.poll();
Assertions.assertNotNull(logRecord, String.format("No record found for %s", level));
Assertions.assertEquals(level.name(), logRecord.getLevel().getName());
Assertions.assertEquals(msg, logRecord.getMessage());
}
@Override
Logger getLogger() {
return logger;
}
@Override
Class extends Logger> getLoggerClass() {
return JBossLogManagerLogger.class;
}
private static TestHandler createHandler(final LogContext logContext, final String loggerName) {
final TestHandler handler = new TestHandler();
final java.util.logging.Logger julLogger = logContext.getLogger(loggerName);
julLogger.addHandler(handler);
julLogger.setLevel(Level.ALL);
return handler;
}
private static class TestHandler extends Handler {
final BlockingQueue queue = new LinkedBlockingQueue<>();
@Override
public void publish(final LogRecord record) {
queue.add(record);
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
queue.clear();
}
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/JulClassPathTestCase.java 0000664 0000000 0000000 00000001627 14167375145 0030220 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
/**
* @author James R. Perkins
*/
public class JulClassPathTestCase extends AbstractClassPathTestCase {
@Override
Class extends Logger> getLoggerClass() {
return JDKLogger.class;
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/JulProviderTestCase.java 0000664 0000000 0000000 00000007532 14167375145 0030131 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* @author James R. Perkins
*/
public class JulProviderTestCase extends AbstractLoggerTestCase {
private TestHandler handler;
private Logger logger;
@BeforeAll
public static void setup() {
System.setProperty("org.jboss.logging.provider", "jdk");
}
@BeforeEach
public void setupLogContext() {
logger = Logger.getLogger(getClass());
handler = createHandler(logger.getName());
}
@AfterEach
public void removeHandler() {
java.util.logging.Logger.getLogger(logger.getName()).removeHandler(handler);
handler.close();
}
@Test
public void testMdc() {
MDC.put("test.key", "value");
Assertions.assertEquals("value", MDC.get("test.key"));
}
@Test
public void testNdc() {
NDC.push("value1");
NDC.push("value2");
Assertions.assertEquals("value2", NDC.peek());
Assertions.assertEquals("value1 value2", NDC.get());
Assertions.assertEquals(2, NDC.getDepth());
// Pop the stack
Assertions.assertEquals("value2", NDC.pop());
Assertions.assertEquals(1, NDC.getDepth());
Assertions.assertEquals("value1", NDC.get());
}
@Override
void testLog(final Logger.Level level) {
final String msg = String.format("Test log message at %s", level);
logger.log(level, msg);
Assertions.assertTrue(logger.isEnabled(level), String.format("Logger not enabled for level %s", level));
testLog(msg, level);
}
@Override
void testLog(final String msg, final Logger.Level level) {
final LogRecord logRecord = handler.queue.poll();
Assertions.assertNotNull(logRecord, String.format("No record found for %s", level));
Assertions.assertEquals(level.name(), logRecord.getLevel().getName());
Assertions.assertEquals(msg, logRecord.getMessage());
}
@Override
Logger getLogger() {
return logger;
}
@Override
Class extends Logger> getLoggerClass() {
return JDKLogger.class;
}
private static TestHandler createHandler(final String loggerName) {
final TestHandler handler = new TestHandler();
final java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(loggerName);
julLogger.addHandler(handler);
julLogger.setLevel(Level.ALL);
return handler;
}
private static class TestHandler extends Handler {
final BlockingQueue queue = new LinkedBlockingQueue<>();
@Override
public void publish(final LogRecord record) {
queue.add(record);
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
queue.clear();
}
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/Log4j2ClassPathTestCase.java 0000664 0000000 0000000 00000001635 14167375145 0030526 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
/**
* @author James R. Perkins
*/
public class Log4j2ClassPathTestCase extends AbstractClassPathTestCase {
@Override
Class extends Logger> getLoggerClass() {
return Log4j2Logger.class;
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/Log4j2ProviderTestCase.java 0000664 0000000 0000000 00000013462 14167375145 0030437 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.io.Serializable;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.ThreadContext;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.Layout;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.appender.AbstractAppender;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginElement;
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* @author James R. Perkins
*/
public class Log4j2ProviderTestCase extends AbstractLoggerTestCase {
private TestAppender appender;
private Logger logger;
@BeforeAll
public static void setup() {
System.setProperty("org.jboss.logging.provider", "log4j2");
}
@BeforeEach
public void setupLogContext() {
logger = Logger.getLogger(getClass());
final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
final Configuration config = ctx.getConfiguration();
appender = (TestAppender) config.getAppenders().get("TestAppender");
}
@Test
public void testMdc() {
MDC.put("test.key", "value");
Assertions.assertEquals("value", MDC.get("test.key"));
Assertions.assertEquals("value", ThreadContext.get("test.key"));
}
@Test
public void testNdc() {
NDC.push("value1");
NDC.push("value2");
Assertions.assertEquals("value2", NDC.peek());
// TODO (jrp) This is a weird case we should validate. NDC.get() does ThreadContext.peek() which doesn't seem
// TODO (jrp) correct. The method should likely do ThreadContext.getImmutableStack().toString(). At least that
// TODO (jrp) is what the NdcPatternConverter does.
//Assertions.assertEquals("[value1, value2]", NDC.get());
Assertions.assertEquals(2, NDC.getDepth());
// Test the log manager values
Assertions.assertEquals("[value1, value2]", ThreadContext.getImmutableStack().toString());
Assertions.assertEquals(2, ThreadContext.getDepth());
// Pop the stack
Assertions.assertEquals("value2", NDC.pop());
Assertions.assertEquals(1, NDC.getDepth());
Assertions.assertEquals("value1", NDC.get());
Assertions.assertEquals("value1", ThreadContext.peek());
Assertions.assertEquals(1, ThreadContext.getDepth());
}
@Override
void testLog(final Logger.Level level) {
final String msg = String.format("Test log message at %s", level);
logger.log(level, msg);
Assertions.assertTrue(logger.isEnabled(level), String.format("Logger not enabled for level %s", level));
testLog(msg, level);
}
@Override
void testLog(final String msg, final Logger.Level level) {
final LogEvent event = appender.queue.poll();
Assertions.assertNotNull(event, String.format("No record found for %s", level));
Assertions.assertEquals(level.name(), event.getLevel().toString());
Assertions.assertEquals(msg, event.getMessage().getFormattedMessage());
}
@Override
Logger getLogger() {
return logger;
}
@Override
Class extends Logger> getLoggerClass() {
return Log4j2Logger.class;
}
@SuppressWarnings("unused")
@Plugin(name = "TestAppender", category = "Core", elementType = "appender", printObject = true)
public static class TestAppender extends AbstractAppender {
final BlockingQueue queue = new LinkedBlockingQueue<>();
protected TestAppender(String name, Filter filter, Layout extends Serializable> layout) {
super(name, filter, layout, false, null);
}
@Override
public void append(final LogEvent event) {
queue.add(event.toImmutable());
}
@Override
public void stop() {
queue.clear();
super.stop();
}
@PluginFactory
public static TestAppender createAppender(@PluginAttribute("name") String name,
@PluginElement("Layout") Layout extends Serializable> layout,
@PluginElement("Filter") final Filter filter,
@PluginAttribute("otherAttribute") String otherAttribute) {
if (name == null) {
LOGGER.error("No name provided for TestAppender");
return null;
}
if (layout == null) {
layout = PatternLayout.createDefaultLayout();
}
return new TestAppender(name, filter, layout);
}
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/Log4jClassPathTestCase.java 0000664 0000000 0000000 00000001633 14167375145 0030442 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
/**
* @author James R. Perkins
*/
public class Log4jClassPathTestCase extends AbstractClassPathTestCase {
@Override
Class extends Logger> getLoggerClass() {
return Log4jLogger.class;
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/Log4jProviderTestCase.java 0000664 0000000 0000000 00000010520 14167375145 0030345 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* @author James R. Perkins
*/
public class Log4jProviderTestCase extends AbstractLoggerTestCase {
private TestAppender appender;
private Logger logger;
@BeforeAll
public static void setup() {
System.setProperty("org.jboss.logging.provider", "log4j");
}
@BeforeEach
public void setupLogContext() {
logger = Logger.getLogger(getClass());
appender = createAppender(logger.getName());
}
@AfterEach
public void removeAppender() {
org.apache.log4j.Logger.getLogger(logger.getName()).removeAppender(appender);
appender.close();
}
@Test
public void testMdc() {
MDC.put("test.key", "value");
Assertions.assertEquals("value", MDC.get("test.key"));
Assertions.assertEquals("value", org.apache.log4j.MDC.get("test.key"));
}
@Test
public void testNdc() {
NDC.push("value1");
NDC.push("value2");
Assertions.assertEquals("value2", NDC.peek());
Assertions.assertEquals("value1 value2", NDC.get());
Assertions.assertEquals(2, NDC.getDepth());
// Test the log manager values
Assertions.assertEquals("value1 value2", org.apache.log4j.NDC.get());
Assertions.assertEquals(2, org.apache.log4j.NDC.getDepth());
// Pop the stack
Assertions.assertEquals("value2", NDC.pop());
Assertions.assertEquals(1, NDC.getDepth());
Assertions.assertEquals("value1", NDC.get());
Assertions.assertEquals("value1", org.apache.log4j.NDC.get());
Assertions.assertEquals(1, org.apache.log4j.NDC.getDepth());
}
@Override
void testLog(final Logger.Level level) {
final String msg = String.format("Test log message at %s", level);
logger.log(level, msg);
Assertions.assertTrue(logger.isEnabled(level), String.format("Logger not enabled for level %s", level));
testLog(msg, level);
}
@Override
void testLog(final String msg, final Logger.Level level) {
final LoggingEvent event = appender.queue.poll();
Assertions.assertNotNull(event, String.format("No record found for %s", level));
Assertions.assertEquals(level.name(), event.getLevel().toString());
Assertions.assertEquals(msg, event.getMessage());
}
@Override
Logger getLogger() {
return logger;
}
@Override
Class extends Logger> getLoggerClass() {
return Log4jLogger.class;
}
private static TestAppender createAppender(final String loggerName) {
final TestAppender appender = new TestAppender();
final org.apache.log4j.Logger log4jLogger = org.apache.log4j.Logger.getLogger(loggerName);
log4jLogger.addAppender(appender);
log4jLogger.setLevel(Level.ALL);
return appender;
}
private static class TestAppender extends AppenderSkeleton {
final BlockingQueue queue = new LinkedBlockingQueue<>();
@Override
protected void append(final LoggingEvent loggingEvent) {
queue.add(loggingEvent);
}
@Override
public void close() throws SecurityException {
queue.clear();
}
@Override
public boolean requiresLayout() {
return false;
}
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/Slf4jClassPathTestCase.java 0000664 0000000 0000000 00000001650 14167375145 0030444 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
/**
* @author James R. Perkins
*/
public class Slf4jClassPathTestCase extends AbstractClassPathTestCase {
@Override
Class extends Logger> getLoggerClass() {
return Slf4jLocationAwareLogger.class;
}
}
jboss-logging-3.4.3.Final/src/test/java/org/jboss/logging/Slf4jProviderTestCase.java 0000664 0000000 0000000 00000010406 14167375145 0030353 0 ustar 00root root 0000000 0000000 /*
* JBoss, Home of Professional Open Source.
*
* Copyright 2020 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.logging;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.LoggerFactory;
/**
* @author James R. Perkins
*/
public class Slf4jProviderTestCase extends AbstractLoggerTestCase {
private TestAppender appender;
private Logger logger;
@BeforeAll
public static void setup() {
System.setProperty("org.jboss.logging.provider", "slf4j");
}
@BeforeEach
public void setupLogContext() {
logger = Logger.getLogger(getClass());
appender = createHandler(logger.getName());
}
@AfterEach
public void removeAppender() {
ch.qos.logback.classic.Logger lbLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(logger.getName());
lbLogger.detachAppender(appender);
appender.stop();
}
@Test
public void testMdc() {
MDC.put("test.key", "value");
Assertions.assertEquals("value", MDC.get("test.key"));
Assertions.assertEquals("value", org.slf4j.MDC.get("test.key"));
}
@Test
public void testNdc() {
NDC.push("value1");
NDC.push("value2");
Assertions.assertEquals("value2", NDC.peek());
Assertions.assertEquals("value1 value2", NDC.get());
Assertions.assertEquals(2, NDC.getDepth());
// Pop the stack
Assertions.assertEquals("value2", NDC.pop());
Assertions.assertEquals(1, NDC.getDepth());
Assertions.assertEquals("value1", NDC.get());
}
@Override
void testLog(final Logger.Level level) {
final String msg = String.format("Test log message at %s", level);
logger.log(level, msg);
Assertions.assertTrue(logger.isEnabled(level), String.format("Logger not enabled for level %s", level));
testLog(msg, level);
}
@Override
void testLog(final String msg, final Logger.Level level) {
final ILoggingEvent event = appender.queue.poll();
Assertions.assertNotNull(event, String.format("No record found for %s", level));
final Logger.Level translatedLevel = level == Logger.Level.FATAL ? Logger.Level.ERROR : level;
Assertions.assertEquals(translatedLevel.name(), event.getLevel().toString());
Assertions.assertEquals(msg, event.getFormattedMessage());
}
@Override
Logger getLogger() {
return logger;
}
@Override
Class extends Logger> getLoggerClass() {
return Slf4jLocationAwareLogger.class;
}
private static TestAppender createHandler(final String loggerName) {
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
final TestAppender appender = new TestAppender();
appender.setContext(context);
appender.start();
ch.qos.logback.classic.Logger lbLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(loggerName);
lbLogger.addAppender(appender);
lbLogger.setLevel(Level.ALL);
return appender;
}
public static class TestAppender extends AppenderBase {
final BlockingQueue queue = new LinkedBlockingQueue<>();
@Override
protected void append(final ILoggingEvent event) {
queue.add(event);
}
}
}
jboss-logging-3.4.3.Final/src/test/resources/ 0000775 0000000 0000000 00000000000 14167375145 0021112 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/test/resources/META-INF/ 0000775 0000000 0000000 00000000000 14167375145 0022252 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/test/resources/META-INF/services/ 0000775 0000000 0000000 00000000000 14167375145 0024075 5 ustar 00root root 0000000 0000000 jboss-logging-3.4.3.Final/src/test/resources/META-INF/services/org.jboss.logging.LoggerProvider 0000664 0000000 0000000 00000000065 14167375145 0032305 0 ustar 00root root 0000000 0000000 org.jboss.logging.CustomProviderTestCase$TestProvider jboss-logging-3.4.3.Final/src/test/resources/log4j2-test.xml 0000664 0000000 0000000 00000002174 14167375145 0023716 0 ustar 00root root 0000000 0000000