Skip to content
Permalink
Browse files

Fix issue #234 by delaying file creation until runtime

  • Loading branch information
ndw committed Aug 14, 2016
1 parent 4be34bd commit aa0c256eea50141550e88cfccd87e3f149f14494
Showing with 11 additions and 12 deletions.
  1. +11 −12 src/main/java/com/xmlcalabash/io/PipeLogger.java
@@ -38,7 +38,6 @@
private File baseDir = null;
private int outputCount = 1;


public PipeLogger(XProcRuntime xproc, Log log) {
runtime = xproc;
this.log = log;
@@ -76,6 +75,17 @@ public PipeLogger(XProcRuntime xproc, Log log) {
serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
serializer.setOutputProperty(Serializer.Property.ENCODING, "utf-8");
serializer.setOutputProperty(Serializer.Property.OMIT_XML_DECLARATION, "yes");
}

private String dateTime() {
GregorianCalendar cal = new GregorianCalendar();
String rfc822tz = String.format("%1$tz", cal);
// I assume it's either -0500 or +0100 or something like that...
return String.format("%1$tFT%1$tT", cal) + rfc822tz.substring(0,3) + ":" + rfc822tz.substring(3);
}

public void startLogging() {
String dt = dateTime();

switch (logstyle) {
case PLAIN:
@@ -140,17 +150,6 @@ public PipeLogger(XProcRuntime xproc, Log log) {
}

serializer.setOutputStream(stream);
}

private String dateTime() {
GregorianCalendar cal = new GregorianCalendar();
String rfc822tz = String.format("%1$tz", cal);
// I assume it's either -0500 or +0100 or something like that...
return String.format("%1$tFT%1$tT", cal) + rfc822tz.substring(0,3) + ":" + rfc822tz.substring(3);
}

public void startLogging() {
String dt = dateTime();

if (logstyle == LogOptions.OFF) {
return;

0 comments on commit aa0c256

Please sign in to comment.
You can’t perform that action at this time.