Skip to content

Commit

Permalink
Merge error and trace output in StillnessToll
Browse files Browse the repository at this point in the history
  • Loading branch information
arkanovicz committed Jul 13, 2018
1 parent 50c249c commit d8af67c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/com/republicate/stillness/StillnessTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class StillnessTool {

protected static Logger logger = LoggerFactory.getLogger("stillness");

public static final String STILLNESS_CONFIG_FILE_KEY = "stillness.config";
public static final String STILLNESS_CONFIG_FILE_KEY = "org.republicate.stillness.config";

String _configFile = null;

Expand Down Expand Up @@ -72,15 +72,24 @@ public void scrape(String source,String template) {
}

public String debug(String source,String template) {
Writer dbg = new StringWriter();
String ret = null;
PrintWriter trace = new PrintWriter(new StringWriter());
PrintWriter error = new PrintWriter(new StringWriter());
Exception ex = null;;
try {
PrintWriter writer = new PrintWriter(dbg);
_stillness.setDebugOutput(writer);
_stillness.setDebugOutput(trace);
_stillness.scrape(source,template,(Context)_context);
} catch (Exception e) {
logger.error("exception", e);
ex = e;
} finally {
return dbg.toString();
if (ex != null) {
error.println("<pre>");
ex.printStackTrace(error);
error.println("</pre>");
}
ret = error.toString() + trace.toString();
}
return ret;
}
}

0 comments on commit d8af67c

Please sign in to comment.