[Swift-commit] r5821 - trunk/src/org/griphyn/vdl/karajan/lib

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Jul 7 19:05:40 CDT 2012


Author: hategan
Date: 2012-07-07 19:05:39 -0500 (Sat, 07 Jul 2012)
New Revision: 5821

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/Log.java
Log:
use 'swift' as log source. It's faster vs. not very useful

Modified: trunk/src/org/griphyn/vdl/karajan/lib/Log.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/Log.java	2012-07-06 17:30:11 UTC (rev 5820)
+++ trunk/src/org/griphyn/vdl/karajan/lib/Log.java	2012-07-08 00:05:39 UTC (rev 5821)
@@ -26,13 +26,10 @@
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.globus.cog.karajan.arguments.Arg;
-import org.globus.cog.karajan.stack.Trace;
-import org.globus.cog.karajan.stack.VariableNotFoundException;
 import org.globus.cog.karajan.stack.VariableStack;
 import org.globus.cog.karajan.util.TypeUtil;
 import org.globus.cog.karajan.workflow.ExecutionException;
 import org.globus.cog.karajan.workflow.nodes.AbstractSequentialWithArguments;
-import org.globus.cog.karajan.workflow.nodes.FlowElement;
 
 public class Log extends AbstractSequentialWithArguments {
 	public static final Arg LEVEL = new Arg.Positional("level");
@@ -42,24 +39,10 @@
 		setArguments(Log.class, new Arg[] { LEVEL, MESSAGE, Arg.VARGS });
 	}
 
-	private static Map loggers = new HashMap();
+	public static final Logger logger = Logger.getLogger("swift");
+	private static final Map<String, Level> priorities = new HashMap<String, Level>();
 
-	public static Logger getLogger(String cls) {
-		Logger logger;
-		synchronized (loggers) {
-			logger = (Logger) loggers.get(cls);
-			if (logger == null) {
-				logger = Logger.getLogger("swift." + cls);
-				loggers.put(cls, logger);
-			}
-		}
-		return logger;
-	}
-
-	private static Map priorities;
-
 	static {
-		priorities = new HashMap();
 		priorities.put("debug", Level.DEBUG);
 		priorities.put("info", Level.INFO);
 		priorities.put("warn", Level.WARN);
@@ -68,26 +51,11 @@
 	}
 
 	public static Level getLevel(String lvl) {
-		return (Level) priorities.get(lvl);
+		return priorities.get(lvl);
 	}
-
+	
 	protected void post(VariableStack stack) throws ExecutionException {
-		String cls;
-		FlowElement fe;
-		try{
-			fe = (FlowElement) stack.getDeepVar(Trace.ELEMENT);
-		}
-		catch (VariableNotFoundException e) {
-			fe = null;
-		}
-		if (fe != null) {
-			cls = fe.getElementType();
-		}
-		else {
-			cls = "unknown";
-		}
 		Level lvl = getLevel((String) LEVEL.getValue(stack));
-		Logger logger = getLogger(cls);
 		if (logger.isEnabledFor(lvl)) {
 		    Object smsg = MESSAGE.getValue(stack);
 		    if (smsg != null) {




More information about the Swift-commit mailing list