[izpack-devel] AntAction logging
Bartz, Klaus
Klaus.Bartz at coi.de
Wed Jul 12 09:07:26 CEST 2006
Hi Eric,
uups, that's a bug.
Thank you for your patch, I will include it next time.
Cheers
Klaus
>-----Original Message-----
>From: izpack-devel-admin at berlios.de
>[mailto:izpack-devel-admin at berlios.de]On Behalf Of Eric Rose
>Sent: Wednesday, July 12, 2006 2:08 AM
>To: izpack-devel at lists.berlios.de
>Subject: [izpack-devel] AntAction logging
>
>
>Hi,
>
>I've been using IzPackfor a while - and finding it very
>useful, thank you.
>Lately, I've added some tasks as ant actions, and noticed that
>the logging
>attribute in the Ant actions specification seemed to be ignored.
>
>Looking through the code, I noted that the logFile variable is
>set from the
>XML, but never used. The following patch appears to do the
>right thing for me
>and I was wondering if it was worth including this
>functionality in the
>project generally.
>
>Eric
>
>Index:
>/home/ericr/workspace/izpack-src/src/lib/com/izforge/izpack/eve
>nt/AntAction.java
>===================================================================
>---
>/home/ericr/workspace/izpack-src/src/lib/com/izforge/izpack/eve
>nt/AntAction.java
>(revision 1484)
>+++
>/home/ericr/workspace/izpack-src/src/lib/com/izforge/izpack/eve
>nt/AntAction.java
>(working copy)
>@@ -24,6 +24,8 @@
>
> import java.io.File;
> import java.io.FileInputStream;
>+import java.io.FileNotFoundException;
>+import java.io.FileOutputStream;
> import java.io.PrintStream;
> import java.util.ArrayList;
> import java.util.Iterator;
>@@ -396,8 +398,26 @@
> else if (quiet) msgOutputLevel = 1;
> BuildLogger logger = new DefaultLogger();
> logger.setMessageOutputLevel(msgOutputLevel);
>- logger.setOutputPrintStream(System.out);
>- logger.setErrorPrintStream(System.err);
>+ if (logFile != null)
>+ {
>+ PrintStream printStream;
>+ try
>+ {
>+ printStream = new PrintStream(new
>FileOutputStream(logFile));
>+ logger.setOutputPrintStream(printStream);
>+ logger.setErrorPrintStream(printStream);
>+ }
>+ catch (FileNotFoundException e)
>+ {
>+ logger.setOutputPrintStream(System.out);
>+ logger.setErrorPrintStream(System.err);
>+ }
>+ }
>+ else
>+ {
>+ logger.setOutputPrintStream(System.out);
>+ logger.setErrorPrintStream(System.err);
>+ }
> return logger;
> }
>
>
>--
>Eric Rose | "Sed quis custodiet ipsos custodes?"
>eric at integeo.com | Juvenal (Satires, VI.347-8)
>
>***********************************************************************
>This message contains privileged and confidential information intended
>only for the use of the addressee named above. If you are not the
>intended recipient of this message you must not disseminate, copy or
>take any action in reliance on it. If you have received this message
>in error please notify the sender immediately. Any views expressed in
>this message are those of the individual sender, except where the
>sender specifically states them to be the views of another (including
>a Body Corporate).
>
>If you wish to opt out from future messages, send an email to
>unsubscribe at integeo.com with the subject UNSUBSCRIBE
>***************************************************************
>*********
>
>
More information about the izpack-devel
mailing list