Skip to content

Commit

Permalink
YARN-6958. Moving logging APIs over to slf4j in hadoop-yarn-server-ti…
Browse files Browse the repository at this point in the history
…melineservice. Contributed by Yeliang Cang.
  • Loading branch information
aajisaka committed Aug 9, 2017
1 parent 69afa26 commit 63cfcb9
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 91 deletions.
Expand Up @@ -19,8 +19,6 @@
package org.apache.hadoop.yarn.server.timeline;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration;
Expand All @@ -34,6 +32,8 @@
import org.iq80.leveldb.DB;
import org.iq80.leveldb.DBIterator;
import org.iq80.leveldb.Options;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
Expand All @@ -58,8 +58,8 @@
@Private
@Unstable
public class LevelDBCacheTimelineStore extends KeyValueBasedTimelineStore {
private static final Log LOG
= LogFactory.getLog(LevelDBCacheTimelineStore.class);
private static final Logger LOG
= LoggerFactory.getLogger(LevelDBCacheTimelineStore.class);
private static final String CACHED_LDB_FILE_PREFIX = "-timeline-cache.ldb";
private String dbId;
private DB entityDb;
Expand Down Expand Up @@ -102,7 +102,7 @@ protected synchronized void serviceInit(Configuration conf) throws Exception {
localFS.setPermission(dbPath, LeveldbUtils.LEVELDB_DIR_UMASK);
}
} finally {
IOUtils.cleanup(LOG, localFS);
IOUtils.cleanupWithLogger(LOG, localFS);
}
LOG.info("Using leveldb path " + dbPath);
entityDb = factory.open(new File(dbPath.toString()), options);
Expand All @@ -113,7 +113,7 @@ protected synchronized void serviceInit(Configuration conf) throws Exception {

@Override
protected synchronized void serviceStop() throws Exception {
IOUtils.cleanup(LOG, entityDb);
IOUtils.cleanupWithLogger(LOG, entityDb);
Path dbPath = new Path(
configuration.get(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH),
dbId + CACHED_LDB_FILE_PREFIX);
Expand All @@ -125,7 +125,7 @@ protected synchronized void serviceStop() throws Exception {
"timeline store " + dbPath);
}
} finally {
IOUtils.cleanup(LOG, localFS);
IOUtils.cleanupWithLogger(LOG, localFS);
}
super.serviceStop();
}
Expand Down
Expand Up @@ -22,8 +22,6 @@
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.filter.BinaryComparator;
import org.apache.hadoop.hbase.filter.BinaryPrefixComparator;
import org.apache.hadoop.hbase.filter.FamilyFilter;
Expand All @@ -36,13 +34,16 @@
import org.apache.hadoop.yarn.server.timelineservice.storage.common.ColumnPrefix;
import org.apache.hadoop.hbase.filter.QualifierFilter;
import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Set of utility methods used by timeline filter classes.
*/
public final class TimelineFilterUtils {

private static final Log LOG = LogFactory.getLog(TimelineFilterUtils.class);
private static final Logger LOG =
LoggerFactory.getLogger(TimelineFilterUtils.class);

private TimelineFilterUtils() {
}
Expand Down
Expand Up @@ -21,8 +21,6 @@
import java.io.IOException;
import java.util.Set;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
Expand All @@ -34,15 +32,17 @@
import org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext;
import org.apache.hadoop.yarn.server.timelineservice.storage.reader.TimelineEntityReader;
import org.apache.hadoop.yarn.server.timelineservice.storage.reader.TimelineEntityReaderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* HBase based implementation for {@link TimelineReader}.
*/
public class HBaseTimelineReaderImpl
extends AbstractService implements TimelineReader {

private static final Log LOG = LogFactory
.getLog(HBaseTimelineReaderImpl.class);
private static final Logger LOG = LoggerFactory
.getLogger(HBaseTimelineReaderImpl.class);

private Configuration hbaseConf = null;
private Connection conn;
Expand Down
Expand Up @@ -21,8 +21,6 @@
import java.util.Map;
import java.util.Set;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -65,6 +63,8 @@
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunColumnPrefix;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunRowKey;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This implements a hbase based backend for storing the timeline entity
Expand All @@ -76,8 +76,8 @@
public class HBaseTimelineWriterImpl extends AbstractService implements
TimelineWriter {

private static final Log LOG = LogFactory
.getLog(HBaseTimelineWriterImpl.class);
private static final Logger LOG = LoggerFactory
.getLogger(HBaseTimelineWriterImpl.class);

private Connection conn;
private TypedBufferedMutator<EntityTable> entityTable;
Expand Down
Expand Up @@ -29,8 +29,6 @@
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
Expand All @@ -46,6 +44,8 @@
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunTable;

import com.google.common.annotations.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This creates the schema for a hbase based backend for storing application
Expand All @@ -58,7 +58,8 @@ private TimelineSchemaCreator() {
}

final static String NAME = TimelineSchemaCreator.class.getSimpleName();
private static final Log LOG = LogFactory.getLog(TimelineSchemaCreator.class);
private static final Logger LOG =
LoggerFactory.getLogger(TimelineSchemaCreator.class);
private static final String SKIP_EXISTING_TABLE_OPTION_SHORT = "s";
private static final String APP_METRICS_TTL_OPTION_SHORT = "ma";
private static final String APP_TABLE_NAME_SHORT = "a";
Expand Down
Expand Up @@ -19,8 +19,6 @@

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
Expand All @@ -30,6 +28,8 @@
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTable;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineHBaseSchemaConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The application table as column families info, config and metrics. Info
Expand Down Expand Up @@ -99,7 +99,8 @@ public class ApplicationTable extends BaseTable<ApplicationTable> {
/** default max number of versions. */
private static final int DEFAULT_METRICS_MAX_VERSIONS = 10000;

private static final Log LOG = LogFactory.getLog(ApplicationTable.class);
private static final Logger LOG =
LoggerFactory.getLogger(ApplicationTable.class);

public ApplicationTable() {
super(TABLE_NAME_CONF_NAME, DEFAULT_TABLE_NAME);
Expand Down
Expand Up @@ -18,8 +18,6 @@
package org.apache.hadoop.yarn.server.timelineservice.storage.apptoflow;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
Expand All @@ -29,6 +27,8 @@
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTable;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineHBaseSchemaConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

Expand Down Expand Up @@ -68,7 +68,8 @@ public class AppToFlowTable extends BaseTable<AppToFlowTable> {
/** default value for app_flow table name. */
private static final String DEFAULT_TABLE_NAME = "timelineservice.app_flow";

private static final Log LOG = LogFactory.getLog(AppToFlowTable.class);
private static final Logger LOG =
LoggerFactory.getLogger(AppToFlowTable.class);

public AppToFlowTable() {
super(TABLE_NAME_CONF_NAME, DEFAULT_TABLE_NAME);
Expand Down
Expand Up @@ -24,21 +24,23 @@
import java.util.NavigableMap;
import java.util.TreeMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.AggregationCompactionDimension;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This class is meant to be used only by explicit Columns, and not directly to
* write by clients.
*
* @param <T> refers to the table.
*/
public class ColumnHelper<T> {
private static final Log LOG = LogFactory.getLog(ColumnHelper.class);
private static final Logger LOG =
LoggerFactory.getLogger(ColumnHelper.class);

private final ColumnFamily<T> columnFamily;

Expand Down
Expand Up @@ -17,8 +17,6 @@

package org.apache.hadoop.yarn.server.timelineservice.storage.common;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
Expand All @@ -30,6 +28,8 @@
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.AggregationOperation;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute;
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;
Expand All @@ -41,8 +41,8 @@
public final class HBaseTimelineStorageUtils {
/** milliseconds in one day. */
public static final long MILLIS_ONE_DAY = 86400000L;
private static final Log LOG =
LogFactory.getLog(HBaseTimelineStorageUtils.class);
private static final Logger LOG =
LoggerFactory.getLogger(HBaseTimelineStorageUtils.class);

private HBaseTimelineStorageUtils() {
}
Expand Down
Expand Up @@ -19,8 +19,6 @@

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
Expand All @@ -30,6 +28,8 @@
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTable;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineHBaseSchemaConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The entity table as column families info, config and metrics. Info stores
Expand Down Expand Up @@ -99,7 +99,8 @@ public class EntityTable extends BaseTable<EntityTable> {
/** default max number of versions. */
private static final int DEFAULT_METRICS_MAX_VERSIONS = 10000;

private static final Log LOG = LogFactory.getLog(EntityTable.class);
private static final Logger LOG =
LoggerFactory.getLogger(EntityTable.class);

public EntityTable() {
super(TABLE_NAME_CONF_NAME, DEFAULT_TABLE_NAME);
Expand Down
Expand Up @@ -19,8 +19,6 @@

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
Expand All @@ -29,6 +27,8 @@
import org.apache.hadoop.hbase.regionserver.BloomType;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The flow activity table has column family info
Expand Down Expand Up @@ -63,7 +63,8 @@ public class FlowActivityTable extends BaseTable<FlowActivityTable> {
public static final String DEFAULT_TABLE_NAME =
"timelineservice.flowactivity";

private static final Log LOG = LogFactory.getLog(FlowActivityTable.class);
private static final Logger LOG =
LoggerFactory.getLogger(FlowActivityTable.class);

/** default max number of versions. */
public static final int DEFAULT_METRICS_MAX_VERSIONS = Integer.MAX_VALUE;
Expand Down
Expand Up @@ -24,8 +24,6 @@
import java.util.NavigableMap;
import java.util.TreeMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
Expand All @@ -50,13 +48,16 @@
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineStorageUtils;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimestampGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Coprocessor for flow run table.
*/
public class FlowRunCoprocessor extends BaseRegionObserver {

private static final Log LOG = LogFactory.getLog(FlowRunCoprocessor.class);
private static final Logger LOG =
LoggerFactory.getLogger(FlowRunCoprocessor.class);
private boolean isFlowRunRegion = false;

private Region region;
Expand Down
Expand Up @@ -19,8 +19,6 @@

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
Expand All @@ -29,6 +27,8 @@
import org.apache.hadoop.hbase.regionserver.BloomType;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.timelineservice.storage.common.BaseTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The flow run table has column family info
Expand Down Expand Up @@ -94,7 +94,8 @@ public class FlowRunTable extends BaseTable<FlowRunTable> {
/** default value for flowrun table name. */
public static final String DEFAULT_TABLE_NAME = "timelineservice.flowrun";

private static final Log LOG = LogFactory.getLog(FlowRunTable.class);
private static final Logger LOG =
LoggerFactory.getLogger(FlowRunTable.class);

/** default max number of versions. */
public static final int DEFAULT_METRICS_MAX_VERSIONS = Integer.MAX_VALUE;
Expand Down

0 comments on commit 63cfcb9

Please sign in to comment.