HADOOP-17482: Remove Commons Logger from FileSystem Class (#2633)
This commit is contained in:
parent
b54134661b
commit
21a3fc3d2d
@ -223,7 +223,7 @@ public <T extends FileSystem & Renewable> RenewAction<T> addRenewAction(final T
|
|||||||
if (action.token != null) {
|
if (action.token != null) {
|
||||||
queue.add(action);
|
queue.add(action);
|
||||||
} else {
|
} else {
|
||||||
fs.LOG.error("does not have a token for renewal");
|
FileSystem.LOG.error("does not have a token for renewal");
|
||||||
}
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
@ -247,7 +247,6 @@ public <T extends FileSystem & Renewable> void removeRenewAction(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
@ -260,8 +259,7 @@ public void run() {
|
|||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
return;
|
return;
|
||||||
} catch (Exception ie) {
|
} catch (Exception ie) {
|
||||||
action.weakFs.get().LOG.warn("Failed to renew token, action=" + action,
|
FileSystem.LOG.warn("Failed to renew token, action=" + action, ie);
|
||||||
ie);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,6 @@
|
|||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.classification.InterfaceStability;
|
import org.apache.hadoop.classification.InterfaceStability;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
@ -183,7 +181,7 @@ public abstract class FileSystem extends Configured
|
|||||||
* so must be considered something to only be changed with care.
|
* so must be considered something to only be changed with care.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public static final Log LOG = LogFactory.getLog(FileSystem.class);
|
public static final Logger LOG = LoggerFactory.getLogger(FileSystem.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The SLF4J logger to use in logging within the FileSystem class itself.
|
* The SLF4J logger to use in logging within the FileSystem class itself.
|
||||||
@ -3391,15 +3389,7 @@ private static void loadFileSystems() {
|
|||||||
LOGGER.info("Full exception loading: {}", fs, e);
|
LOGGER.info("Full exception loading: {}", fs, e);
|
||||||
}
|
}
|
||||||
} catch (ServiceConfigurationError ee) {
|
} catch (ServiceConfigurationError ee) {
|
||||||
LOG.warn("Cannot load filesystem: " + ee);
|
LOGGER.warn("Cannot load filesystem", ee);
|
||||||
Throwable cause = ee.getCause();
|
|
||||||
// print all the nested exception messages
|
|
||||||
while (cause != null) {
|
|
||||||
LOG.warn(cause.toString());
|
|
||||||
cause = cause.getCause();
|
|
||||||
}
|
|
||||||
// and at debug: the full stack
|
|
||||||
LOG.debug("Stack Trace", ee);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FILE_SYSTEMS_LOADED = true;
|
FILE_SYSTEMS_LOADED = true;
|
||||||
|
@ -318,7 +318,7 @@ private LocalFSFileOutputStream(Path f, boolean append,
|
|||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
IOUtils.cleanup(LOG, this.fos);
|
IOUtils.cleanupWithLogger(LOG, this.fos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,10 +630,9 @@ protected InodeTree(final Configuration config, final String viewName,
|
|||||||
.append(theUri.getScheme()).append("://").append(mountTableName)
|
.append(theUri.getScheme()).append("://").append(mountTableName)
|
||||||
.append("/").toString());
|
.append("/").toString());
|
||||||
}
|
}
|
||||||
StringBuilder msg =
|
FileSystem.LOG
|
||||||
new StringBuilder("Empty mount table detected for ").append(theUri)
|
.info("Empty mount table detected for {} and considering itself "
|
||||||
.append(" and considering itself as a linkFallback.");
|
+ "as a linkFallback.", theUri);
|
||||||
FileSystem.LOG.info(msg.toString());
|
|
||||||
rootFallbackLink =
|
rootFallbackLink =
|
||||||
new INodeLink<T>(mountTableName, ugi, getTargetFileSystem(theUri),
|
new INodeLink<T>(mountTableName, ugi, getTargetFileSystem(theUri),
|
||||||
theUri);
|
theUri);
|
||||||
|
@ -1289,10 +1289,8 @@ public FSDataOutputStream create(final Path f,
|
|||||||
.create(fileToCreate, permission, overwrite, bufferSize,
|
.create(fileToCreate, permission, overwrite, bufferSize,
|
||||||
replication, blockSize, progress);
|
replication, blockSize, progress);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
StringBuilder msg =
|
LOG.error("Failed to create file: {} at fallback: {}", fileToCreate,
|
||||||
new StringBuilder("Failed to create file:").append(fileToCreate)
|
linkedFallbackFs.getUri(), e);
|
||||||
.append(" at fallback : ").append(linkedFallbackFs.getUri());
|
|
||||||
LOG.error(msg.toString(), e);
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1523,11 +1521,8 @@ public boolean mkdirs(Path dir, FsPermission permission)
|
|||||||
return linkedFallbackFs.mkdirs(dirToCreate, permission);
|
return linkedFallbackFs.mkdirs(dirToCreate, permission);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
StringBuilder msg =
|
LOG.debug("Failed to create: {} at fallback: {}", dirToCreate,
|
||||||
new StringBuilder("Failed to create ").append(dirToCreate)
|
linkedFallbackFs.getUri(), e);
|
||||||
.append(" at fallback : ")
|
|
||||||
.append(linkedFallbackFs.getUri());
|
|
||||||
LOG.debug(msg.toString(), e);
|
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.permission.FsPermission;
|
import org.apache.hadoop.fs.permission.FsPermission;
|
||||||
import org.apache.hadoop.fs.Options.CreateOpts;
|
import org.apache.hadoop.fs.Options.CreateOpts;
|
||||||
@ -39,10 +38,11 @@
|
|||||||
import org.apache.hadoop.util.Progressable;
|
import org.apache.hadoop.util.Progressable;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
public class TestFilterFileSystem {
|
public class TestFilterFileSystem {
|
||||||
|
|
||||||
private static final Log LOG = FileSystem.LOG;
|
private static final Logger LOG = FileSystem.LOG;
|
||||||
private static final Configuration conf = new Configuration();
|
private static final Configuration conf = new Configuration();
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
@ -23,14 +23,14 @@
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.viewfs.ConfigUtil;
|
import org.apache.hadoop.fs.viewfs.ConfigUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
public class TestFilterFs {
|
public class TestFilterFs {
|
||||||
|
|
||||||
private static final Log LOG = FileSystem.LOG;
|
private static final Logger LOG = FileSystem.LOG;
|
||||||
|
|
||||||
public static class DontCheck {
|
public static class DontCheck {
|
||||||
public void checkScheme(URI uri, String supportedScheme) { }
|
public void checkScheme(URI uri, String supportedScheme) { }
|
||||||
|
@ -29,10 +29,7 @@
|
|||||||
import org.apache.hadoop.hdfs.HdfsConfiguration;
|
import org.apache.hadoop.hdfs.HdfsConfiguration;
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
|
||||||
import org.apache.hadoop.util.StringUtils;
|
|
||||||
import static org.apache.hadoop.fs.FileContextTestHelper.*;
|
import static org.apache.hadoop.fs.FileContextTestHelper.*;
|
||||||
import org.apache.log4j.Level;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
@ -101,16 +98,6 @@ public static void ClusterShutdownAtEnd() throws Exception {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
GenericTestUtils.setLogLevel(FileSystem.LOG, Level.DEBUG);
|
|
||||||
}
|
|
||||||
catch(Exception e) {
|
|
||||||
System.out.println("Cannot change log level\n"
|
|
||||||
+ StringUtils.stringifyException(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
fc.setUMask(WIDE_OPEN_TEST_UMASK);
|
fc.setUMask(WIDE_OPEN_TEST_UMASK);
|
||||||
|
@ -17,11 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hdfs;
|
package org.apache.hadoop.hdfs;
|
||||||
|
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.fs.TestListFiles;
|
import org.apache.hadoop.fs.TestListFiles;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
|
||||||
import org.apache.log4j.Level;
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
@ -29,10 +26,6 @@
|
|||||||
* This class tests the FileStatus API.
|
* This class tests the FileStatus API.
|
||||||
*/
|
*/
|
||||||
public class TestListFilesInDFS extends TestListFiles {
|
public class TestListFilesInDFS extends TestListFiles {
|
||||||
{
|
|
||||||
GenericTestUtils.setLogLevel(FileSystem.LOG, Level.ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static MiniDFSCluster cluster;
|
private static MiniDFSCluster cluster;
|
||||||
|
|
||||||
|
@ -29,14 +29,11 @@
|
|||||||
import org.apache.hadoop.fs.CreateFlag;
|
import org.apache.hadoop.fs.CreateFlag;
|
||||||
import org.apache.hadoop.fs.FSDataOutputStream;
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||||
import org.apache.hadoop.fs.FileContext;
|
import org.apache.hadoop.fs.FileContext;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
|
||||||
import org.apache.hadoop.fs.LocatedFileStatus;
|
import org.apache.hadoop.fs.LocatedFileStatus;
|
||||||
import org.apache.hadoop.fs.Options;
|
import org.apache.hadoop.fs.Options;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.fs.RemoteIterator;
|
import org.apache.hadoop.fs.RemoteIterator;
|
||||||
import org.apache.hadoop.fs.permission.FsPermission;
|
import org.apache.hadoop.fs.permission.FsPermission;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
|
||||||
import org.apache.log4j.Level;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
@ -46,9 +43,6 @@
|
|||||||
* This class tests the FileStatus API.
|
* This class tests the FileStatus API.
|
||||||
*/
|
*/
|
||||||
public class TestListFilesInFileContext {
|
public class TestListFilesInFileContext {
|
||||||
{
|
|
||||||
GenericTestUtils.setLogLevel(FileSystem.LOG, Level.ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static final long seed = 0xDEADBEEFL;
|
static final long seed = 0xDEADBEEFL;
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ protected OutputStream createOutputStreamWithMode(Path f, boolean append,
|
|||||||
return os;
|
return os;
|
||||||
} finally {
|
} finally {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
IOUtils.cleanup(LOG, os);
|
IOUtils.cleanupWithLogger(LOG, os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user