[Swift-commit] r6212 - trunk/src/org/griphyn/vdl/karajan
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sat Feb 2 02:23:03 CST 2013
Author: hategan
Date: 2013-02-02 02:23:02 -0600 (Sat, 02 Feb 2013)
New Revision: 6212
Modified:
trunk/src/org/griphyn/vdl/karajan/Loader.java
Log:
use async appender to reduce contention when logging is enabled
Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/Loader.java 2013-02-02 02:08:47 UTC (rev 6211)
+++ trunk/src/org/griphyn/vdl/karajan/Loader.java 2013-02-02 08:23:02 UTC (rev 6212)
@@ -40,6 +40,7 @@
import java.util.Map;
import org.apache.log4j.Appender;
+import org.apache.log4j.AsyncAppender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Level;
@@ -221,10 +222,10 @@
arguments.add("-rlog:resume=" + ap.getStringValue(ARG_RESUME));
}
ec.setArguments(arguments);
- // long start = System.currentTimeMillis();
new HangChecker(stack).start();
ec.start(stack);
ec.waitFor();
+
if (ec.isFailed()) {
runerror = true;
}
@@ -560,6 +561,11 @@
else {
fa.setFile(f.getAbsolutePath());
fa.activateOptions();
+
+ AsyncAppender aa = new AsyncAppender();
+ aa.addAppender(fa);
+
+ replaceAppender(fa, aa);
}
Level level = Level.WARN;
if (ap.isPresent(ARG_VERBOSE)) {
@@ -598,6 +604,11 @@
}
}
+ private static void replaceAppender(FileAppender fa, AsyncAppender aa) {
+ Logger root = Logger.getRootLogger();
+ root.removeAppender(fa);
+ root.addAppender(aa);
+ }
@SuppressWarnings({ "rawtypes", "unchecked" })
protected static Appender getAppender(Class cls) {
More information about the Swift-commit
mailing list