svn merge -c 1459576 from trunk for HDFS-4609. TestAuditLogs should release log handles between tests.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1459577 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b005b46a95
commit
66dbdfeaf4
|
@ -103,6 +103,9 @@ Release 2.0.5-beta - UNRELEASED
|
||||||
HDFS-4607. In TestGetConf.testGetSpecificKey(), use a platform-specific
|
HDFS-4607. In TestGetConf.testGetSpecificKey(), use a platform-specific
|
||||||
line separator; otherwise, it fails on Windows. (Ivan Mitic via szetszwo)
|
line separator; otherwise, it fails on Windows. (Ivan Mitic via szetszwo)
|
||||||
|
|
||||||
|
HDFS-4609. TestAuditLogs should release log handles between tests.
|
||||||
|
(Ivan Mitic via szetszwo)
|
||||||
|
|
||||||
Release 2.0.4-alpha - UNRELEASED
|
Release 2.0.4-alpha - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -46,6 +46,7 @@ import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
|
||||||
import org.apache.hadoop.security.AccessControlException;
|
import org.apache.hadoop.security.AccessControlException;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
|
import org.apache.log4j.LogManager;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.log4j.PatternLayout;
|
import org.apache.log4j.PatternLayout;
|
||||||
import org.apache.log4j.RollingFileAppender;
|
import org.apache.log4j.RollingFileAppender;
|
||||||
|
@ -233,9 +234,15 @@ public class TestAuditLogs {
|
||||||
|
|
||||||
/** Sets up log4j logger for auditlogs */
|
/** Sets up log4j logger for auditlogs */
|
||||||
private void setupAuditLogs() throws IOException {
|
private void setupAuditLogs() throws IOException {
|
||||||
|
// Shutdown the LogManager to release all logger open file handles.
|
||||||
|
// Unfortunately, Apache commons logging library does not provide
|
||||||
|
// means to release underlying loggers. For additional info look up
|
||||||
|
// commons library FAQ.
|
||||||
|
LogManager.shutdown();
|
||||||
|
|
||||||
File file = new File(auditLogFile);
|
File file = new File(auditLogFile);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
file.delete();
|
assertTrue(file.delete());
|
||||||
}
|
}
|
||||||
Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
|
Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
|
||||||
logger.setLevel(Level.INFO);
|
logger.setLevel(Level.INFO);
|
||||||
|
|
Loading…
Reference in New Issue