[Swift-commit] cog r3673
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Sat Jun 15 18:50:03 CDT 2013
------------------------------------------------------------------------
r3673 | hategan | 2013-06-15 18:48:32 -0500 (Sat, 15 Jun 2013) | 1 line
prevent log configuration warnings when running along with something that replaces the file appender with an async appender (such as swift)
------------------------------------------------------------------------
Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java
===================================================================
--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java (revision 3672)
+++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java (working copy)
@@ -405,11 +405,8 @@
}
public static void configureLogName() {
- FileAppender fa = (FileAppender) getAppender(FileAppender.class);
- if (fa == null) {
- logger.warn("Failed to configure log file name");
- }
- else {
+ FileAppender fa = (FileAppender) getFileAppender();
+ if (fa != null) {
fa.setFile(Bootstrap.LOG_DIR + File.separator + makeLogFileName());
fa.activateOptions();
@@ -430,16 +427,23 @@
root.addAppender(aa);
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected static Appender getAppender(Class cls) {
+ @SuppressWarnings("rawtypes")
+ protected static Appender getFileAppender() {
Logger root = Logger.getRootLogger();
Enumeration e = root.getAllAppenders();
while (e.hasMoreElements()) {
Appender a = (Appender) e.nextElement();
- if (cls.isAssignableFrom(a.getClass())) {
+ if (a instanceof FileAppender) {
return a;
}
+ if (a instanceof AsyncAppender) {
+ // likely this is running in a JVM in which
+ // the file appender has been replaced with
+ // an async appender, so don't mess with things
+ return null;
+ }
}
+ logger.warn("Could not find a file appender to configure");
return null;
}
More information about the Swift-commit
mailing list