MCPcopy Create free account
hub / github.com/apache/pig / resetLog

Method resetLog

test/org/apache/pig/test/Util.java:1107–1119  ·  view source on GitHub ↗

Delete the existing logFile for the class and set the logging to a use a new log file and set log level to DEBUG @param clazz class for which the log file is being set @param logFile current log file @return new log file @throws Exception

(Class<?> clazz, File logFile)

Source from the content-addressed store, hash-verified

1105 * @throws Exception
1106 */
1107 public static File resetLog(Class<?> clazz, File logFile) throws Exception {
1108 if (logFile != null)
1109 logFile.delete();
1110 Logger logger = Logger.getLogger(clazz);
1111 logger.removeAllAppenders();
1112 logger.setLevel(Level.DEBUG);
1113 SimpleLayout layout = new SimpleLayout();
1114 File newLogFile = File.createTempFile("log", "");
1115 FileAppender appender = new FileAppender(layout, newLogFile.toString(),
1116 false, false, 0);
1117 logger.addAppender(appender);
1118 return newLogFile;
1119 }
1120
1121 /**
1122 * Check if logFile (does not/)contains the given list of messages.

Callers 2

Calls 4

deleteMethod · 0.65
getLoggerMethod · 0.45
createTempFileMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected