Skip to content

Commit

Permalink
if there's a writer, delegate preamble generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Apr 25, 2024
1 parent 0cc8c70 commit b0db387
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions jpos/src/main/java/org/jpos/util/RotateLogListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.jpos.util;

import org.jdom2.Element;
import org.jpos.core.Configurable;
import org.jpos.core.Configuration;
import org.jpos.core.ConfigurationException;
Expand Down Expand Up @@ -139,7 +140,11 @@ public void setConfiguration (Configuration cfg)
}
};
}
}

@Override
public void setConfiguration(Element e) throws ConfigurationException {
super.setConfiguration(e);
runPostConfiguration();
}

Expand All @@ -156,11 +161,16 @@ protected synchronized void openLogFile() throws IOException {
f.close();
f = new FileOutputStream (logName, true);
setPrintStream (new PrintStream(f));
p.println ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
p.println ("<logger class=\"" + getClass().getName() + "\">");
if (writer == null) {
p.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
p.println("<logger class=\"" + getClass().getName() + "\">");
}
}
protected synchronized void closeLogFile() throws IOException {
p.println ("</logger>");
if (writer != null)
writer.close();
else
p.println ("</logger>");
if (f != null)
f.close();
f = null;
Expand Down

0 comments on commit b0db387

Please sign in to comment.