HDFS-4609. TestAuditLogs should release log handles between tests. Contributed by Ivan Mitic
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1459576 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1b98d8dda3
commit
e976294d35
|
@ -436,9 +436,12 @@ Release 2.0.5-beta - UNRELEASED
|
|||
HDFS-4620. Documentation for dfs.namenode.rpc-address specifies wrong
|
||||
format. (Sandy Ryza via atm)
|
||||
|
||||
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)
|
||||
|
||||
HDFS-4609. TestAuditLogs should release log handles between tests.
|
||||
(Ivan Mitic via szetszwo)
|
||||
|
||||
Release 2.0.4-alpha - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
|
|||
import org.apache.hadoop.security.AccessControlException;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PatternLayout;
|
||||
import org.apache.log4j.RollingFileAppender;
|
||||
|
@ -233,9 +234,15 @@ public class TestAuditLogs {
|
|||
|
||||
/** Sets up log4j logger for auditlogs */
|
||||
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);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
assertTrue(file.delete());
|
||||
}
|
||||
Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
|
||||
logger.setLevel(Level.INFO);
|
||||
|
|
Loading…
Reference in New Issue