-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-17482: Remove Commons Logger from FileSystem Class #2633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,8 +48,6 @@ | |
| import java.util.concurrent.Semaphore; | ||
| 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.InterfaceStability; | ||
| 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. | ||
| */ | ||
| @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. | ||
|
|
@@ -3391,15 +3389,7 @@ private static void loadFileSystems() { | |
| LOGGER.info("Full exception loading: {}", fs, e); | ||
| } | ||
| } catch (ServiceConfigurationError ee) { | ||
| LOG.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); | ||
| LOGGER.warn("Cannot load filesystem", ee); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what the capability of Commons Logger is, but in SLF4J, the entire list of 'caused by' is printed so there is no need to do this manually when switching loggers, but this may also just be an oversight, I'm not sure.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think relying on slf4j and just dumping the whole exception is good. |
||
| } | ||
| } | ||
| FILE_SYSTEMS_LOADED = true; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,10 +29,7 @@ | |
| import org.apache.hadoop.hdfs.HdfsConfiguration; | ||
| import org.apache.hadoop.hdfs.MiniDFSCluster; | ||
| 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 org.apache.log4j.Level; | ||
| import org.junit.After; | ||
| import org.junit.AfterClass; | ||
| import org.junit.Assert; | ||
|
|
@@ -100,16 +97,6 @@ public static void ClusterShutdownAtEnd() throws Exception { | |
| cluster.shutdown(); | ||
| } | ||
| } | ||
|
|
||
| { | ||
| try { | ||
| GenericTestUtils.setLogLevel(FileSystem.LOG, Level.DEBUG); | ||
| } | ||
| catch(Exception e) { | ||
| System.out.println("Cannot change log level\n" | ||
| + StringUtils.stringifyException(e)); | ||
| } | ||
| } | ||
|
Comment on lines
-103
to
-112
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not good practice to modify this manually. Should be using log4j properties files to set logging levels.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its a test and they may have had some good reasons, just as some of the Azure tests do
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to fix it properly then. @belugabehr do you mind undoing this particular one in a separate JIRA or proposing the log4j solution? |
||
|
|
||
| @Before | ||
| public void setUp() throws Exception { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.