[Swift-commit] r4533 - in trunk: etc src/org/griphyn/vdl/karajan src/org/griphyn/vdl/karajan/lib src/org/griphyn/vdl/util
wozniak at ci.uchicago.edu
wozniak at ci.uchicago.edu
Fri May 27 12:26:44 CDT 2011
Author: wozniak
Date: 2011-05-27 12:26:44 -0500 (Fri, 27 May 2011)
New Revision: 4533
Modified:
trunk/etc/log4j.properties
trunk/src/org/griphyn/vdl/karajan/Loader.java
trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
trunk/src/org/griphyn/vdl/util/VDL2Config.java
Log:
Enable auto-insertion of input file text in log
May be disabled by changing log4j.logger.swift.textfiles
Modified: trunk/etc/log4j.properties
===================================================================
--- trunk/etc/log4j.properties 2011-05-27 17:21:44 UTC (rev 4532)
+++ trunk/etc/log4j.properties 2011-05-27 17:26:44 UTC (rev 4533)
@@ -11,12 +11,13 @@
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSSZZZZZ} %-5p %c{1} %m%n
-log4j.logger.swift=DEBUG
log4j.logger.org.apache.axis.utils=ERROR
# Swift
+log4j.logger.swift=DEBUG
+log4j.logger.swift.textfiles=DEBUG
log4j.logger.org.globus.swift.trace=INFO
log4j.logger.org.griphyn.vdl.karajan.Loader=DEBUG
log4j.logger.org.griphyn.vdl.karajan.functions.ProcessBulkErrors=WARN
Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/Loader.java 2011-05-27 17:21:44 UTC (rev 4532)
+++ trunk/src/org/griphyn/vdl/karajan/Loader.java 2011-05-27 17:26:44 UTC (rev 4533)
@@ -37,6 +37,7 @@
import org.globus.cog.karajan.workflow.nodes.grid.AbstractGridNode;
import org.globus.cog.util.ArgumentParser;
import org.globus.cog.util.ArgumentParserException;
+import org.globus.cog.util.TextFileLoader;
import org.globus.swift.data.Director;
import org.griphyn.vdl.engine.Karajan;
import org.griphyn.vdl.karajan.functions.ConfigProperty;
@@ -90,10 +91,10 @@
ap.usage();
System.exit(0);
}
- if (ap.isPresent(ARG_VERSION)){
- ap.version();
- System.exit(0);
- }
+ if (ap.isPresent(ARG_VERSION)){
+ ap.version();
+ System.exit(0);
+ }
if (ap.isPresent(ARG_MONITOR)) {
new Monitor().start();
}
@@ -175,7 +176,8 @@
VariableStack stack = new LinkedStack(ec);
VDL2Config config = loadConfig(ap, stack);
addCommandLineProperties(config, ap);
-
+ debugSitesText(config);
+
if (ap.isPresent(ARG_DRYRUN)) {
stack.setGlobal(CONST_VDL_OPERATION, VDL_OPERATION_DRYRUN);
}
@@ -226,7 +228,8 @@
String cdmString = null;
try {
cdmString = ap.getStringValue(ARG_CDMFILE);
- File cdmFile = new File(cdmString);
+ File cdmFile = new File(cdmString);
+ debugText("CDM FILE", cdmFile);
Director.load(cdmFile);
}
catch (IOException e) {
@@ -246,6 +249,7 @@
ParsingException, IncorrectInvocationException,
CompilationException, IOException {
File swiftscript = new File(project);
+ debugText("SWIFTSCRIPT", swiftscript);
String projectBase = project.substring(0, project.lastIndexOf('.'));
File xml = new File(projectBase + ".xml");
File kml = new File(projectBase + ".kml");
@@ -328,7 +332,44 @@
return kml.getAbsolutePath();
}
- private static void loadBuildVersion() {
+ /**
+ Enter the text content of given files into the log
+ @throws IOException
+ */
+ public static void debugText(String name, File file) {
+ Logger textLogger = Logger.getLogger("swift.textfiles");
+ try {
+ if (textLogger.isDebugEnabled()) {
+ String text = TextFileLoader.loadFromFile(file);
+ textLogger.debug("BEGIN " + name + ":\n" + text + "\n");
+ textLogger.debug("END " + name + ":");
+ }
+ }
+ catch (IOException e) {
+ logger.warn("Could not open: " + file);
+ }
+ }
+
+ static void debugSitesText(VDL2Config config) {
+ VDL2Config defaultConfig = null;
+ try {
+ defaultConfig = VDL2Config.getDefaultConfig();
+
+ } catch (IOException e) {
+ logger.warn("Could not log sites file text");
+ }
+ String poolFile = config.getPoolFile();
+ String defaultPoolFile = defaultConfig.getPoolFile();
+ if (poolFile.equals(defaultPoolFile)) {
+ Logger textLogger = Logger.getLogger("swift.textfiles");
+ textLogger.debug("using default sites file");
+ }
+ else {
+ debugText("SITES", new File(poolFile));
+ }
+ }
+
+ private static void loadBuildVersion() {
try {
File f = new File(System.getProperty("swift.home")
+ "/libexec/buildid.txt");
@@ -363,7 +404,9 @@
Map.Entry e = (Map.Entry) i.next();
String name = (String) e.getKey();
if (ap.isPresent(name)) {
- config.setProperty(name, ap.getStringValue(name));
+ String value = ap.getStringValue(name);
+ logger.debug("setting: " + name + " to: " + value);
+ config.setProperty(name, value);
}
}
}
Modified: trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java 2011-05-27 17:21:44 UTC (rev 4532)
+++ trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java 2011-05-27 17:26:44 UTC (rev 4533)
@@ -33,6 +33,7 @@
import org.globus.swift.catalog.transformation.File;
import org.globus.swift.catalog.types.TCType;
import org.griphyn.vdl.karajan.AssertFailedException;
+import org.griphyn.vdl.karajan.Loader;
import org.griphyn.vdl.karajan.TCCache;
import org.griphyn.vdl.karajan.VDL2FutureException;
import org.griphyn.vdl.karajan.WrapperMap;
@@ -608,6 +609,7 @@
TCCache tc = (TCCache) stack.firstFrame().getVar(TC);
if (tc == null) {
String prop = ConfigProperty.getProperty(VDL2ConfigProperties.TC_FILE, stack);
+ Loader.debugText("TC", new java.io.File(prop));
tc = new TCCache(File.getNonSingletonInstance(prop));
stack.firstFrame().setVar(TC, tc);
}
Modified: trunk/src/org/griphyn/vdl/util/VDL2Config.java
===================================================================
--- trunk/src/org/griphyn/vdl/util/VDL2Config.java 2011-05-27 17:21:44 UTC (rev 4532)
+++ trunk/src/org/griphyn/vdl/util/VDL2Config.java 2011-05-27 17:26:44 UTC (rev 4533)
@@ -40,7 +40,7 @@
return config.check();
}
- private static synchronized VDL2Config getDefaultConfig() throws IOException {
+ public static synchronized VDL2Config getDefaultConfig() throws IOException {
if (config == null) {
config = new VDL2Config();
for (int i = 0; i < CONFIG_FILE_SEARCH_PATH.length; i++) {
More information about the Swift-commit
mailing list