HADOOP-14571. Deprecate public APIs relate to log4j1

This closes #244

Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
Wenxin He 2017-06-27 11:51:34 +08:00 committed by Akira Ajisaka
parent 1aaa7f1eac
commit f2aba1da30
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50
3 changed files with 40 additions and 0 deletions

View File

@ -246,7 +246,10 @@ public static void skipFully(InputStream in, long len) throws IOException {
* *
* @param log the log to record problems to at debug level. Can be null. * @param log the log to record problems to at debug level. Can be null.
* @param closeables the objects to close * @param closeables the objects to close
* @deprecated use {@link #cleanupWithLogger(Logger, java.io.Closeable...)}
* instead
*/ */
@Deprecated
public static void cleanup(Log log, java.io.Closeable... closeables) { public static void cleanup(Log log, java.io.Closeable... closeables) {
for (java.io.Closeable c : closeables) { for (java.io.Closeable c : closeables) {
if (c != null) { if (c != null) {

View File

@ -32,6 +32,10 @@ private LogAdapter(Logger LOGGER) {
this.LOGGER = LOGGER; this.LOGGER = LOGGER;
} }
/**
* @deprecated use {@link #create(Logger)} instead
*/
@Deprecated
public static LogAdapter create(Log LOG) { public static LogAdapter create(Log LOG) {
return new LogAdapter(LOG); return new LogAdapter(LOG);
} }

View File

@ -94,20 +94,33 @@ public abstract class GenericTestUtils {
public static final String ERROR_INVALID_ARGUMENT = public static final String ERROR_INVALID_ARGUMENT =
"Total wait time should be greater than check interval time"; "Total wait time should be greater than check interval time";
/**
* @deprecated use {@link #disableLog(org.slf4j.Logger)} instead
*/
@Deprecated
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void disableLog(Log log) { public static void disableLog(Log log) {
// We expect that commons-logging is a wrapper around Log4j. // We expect that commons-logging is a wrapper around Log4j.
disableLog((Log4JLogger) log); disableLog((Log4JLogger) log);
} }
@Deprecated
public static Logger toLog4j(org.slf4j.Logger logger) { public static Logger toLog4j(org.slf4j.Logger logger) {
return LogManager.getLogger(logger.getName()); return LogManager.getLogger(logger.getName());
} }
/**
* @deprecated use {@link #disableLog(org.slf4j.Logger)} instead
*/
@Deprecated
public static void disableLog(Log4JLogger log) { public static void disableLog(Log4JLogger log) {
log.getLogger().setLevel(Level.OFF); log.getLogger().setLevel(Level.OFF);
} }
/**
* @deprecated use {@link #disableLog(org.slf4j.Logger)} instead
*/
@Deprecated
public static void disableLog(Logger logger) { public static void disableLog(Logger logger) {
logger.setLevel(Level.OFF); logger.setLevel(Level.OFF);
} }
@ -116,20 +129,40 @@ public static void disableLog(org.slf4j.Logger logger) {
disableLog(toLog4j(logger)); disableLog(toLog4j(logger));
} }
/**
* @deprecated
* use {@link #setLogLevel(org.slf4j.Logger, org.slf4j.event.Level)} instead
*/
@Deprecated
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void setLogLevel(Log log, Level level) { public static void setLogLevel(Log log, Level level) {
// We expect that commons-logging is a wrapper around Log4j. // We expect that commons-logging is a wrapper around Log4j.
setLogLevel((Log4JLogger) log, level); setLogLevel((Log4JLogger) log, level);
} }
/**
* @deprecated
* use {@link #setLogLevel(org.slf4j.Logger, org.slf4j.event.Level)} instead
*/
@Deprecated
public static void setLogLevel(Log4JLogger log, Level level) { public static void setLogLevel(Log4JLogger log, Level level) {
log.getLogger().setLevel(level); log.getLogger().setLevel(level);
} }
/**
* @deprecated
* use {@link #setLogLevel(org.slf4j.Logger, org.slf4j.event.Level)} instead
*/
@Deprecated
public static void setLogLevel(Logger logger, Level level) { public static void setLogLevel(Logger logger, Level level) {
logger.setLevel(level); logger.setLevel(level);
} }
/**
* @deprecated
* use {@link #setLogLevel(org.slf4j.Logger, org.slf4j.event.Level)} instead
*/
@Deprecated
public static void setLogLevel(org.slf4j.Logger logger, Level level) { public static void setLogLevel(org.slf4j.Logger logger, Level level) {
setLogLevel(toLog4j(logger), level); setLogLevel(toLog4j(logger), level);
} }