Re: Logging work: MessageHandler patch

2002-03-21 Thread Christian Geisert

Michael Gratton wrote:
  There was a problem with MessageHandler.error() in that patch. The
  attached patch fixes that and makes MessageHandler.log() a bit more
  readable. It also includes a fix for the outstanding
  ToBeImplementedProperty problem - by using MessageHandler.

I've committed both (the second MessageHandler patch and the one for
the servlet examples, but still need to re-create the war file..)

  Note that the document patch on the previous message is still valid.

Err .. the documentation is done in the main branch only and as
Jeremias has already made some changes I need to have a closer look
if the patch still applies.

  Mike.

Thanks for your contribution,
Christian



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Logging work: MessageHandler patch

2002-03-21 Thread Jeremias Maerki

Christian

 Michael Gratton wrote:
   There was a problem with MessageHandler.error() in that patch. The
   attached patch fixes that and makes MessageHandler.log() a bit more
   readable. It also includes a fix for the outstanding
   ToBeImplementedProperty problem - by using MessageHandler.
 
 I've committed both (the second MessageHandler patch and the one for
 the servlet examples, but still need to re-create the war file..)

I'd suggest we move the embedding example into the contrib directory
(need to create that one for the maintenance branch, I think) and build
that WAR from the build script. That may reduce the size of the
distribution and lets people build their own WAR if they want to change
anything.

If you don't want to do it, you can tell me and I'm going to do that
during the weekend and send you a patch.

   Note that the document patch on the previous message is still valid.
 
 Err .. the documentation is done in the main branch only and as
 Jeremias has already made some changes I need to have a closer look
 if the patch still applies.

Well, I hope I did that documentation stuff right. I imagined that I
have to do the documentation versus the main branch so it gets enabled
under xml.apache.org/fop. Tell me, if I have to change anything else.

Cheers,
Jeremias Märki

mailto:[EMAIL PROTECTED]

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Logging work: MessageHandler patch

2002-03-18 Thread Michael Gratton



Michael Gratton wrote:
 
 Attached is a patch (for the 'fop-0_20_2-maintain' branch) for 
 MessageHandler

There was a problem with MessageHandler.error() in that patch. The 
attached patch fixes that and makes MessageHandler.log() a bit more 
readable. It also includes a fix for the outstanding 
ToBeImplementedProperty problem - by using MessageHandler.

Note that the document patch on the previous message is still valid.

Mike.
-- 
Michael Gratton [EMAIL PROTECTED]
Recall Design http://www.recalldesign.com/
s: 53 Gilbert Street Adelaide SA 5000 Australia
t: +61 8 8217 0500 f: +61 8 8217 0555


Index: src/org/apache/fop/messaging/MessageHandler.java
===
RCS file: 
/home/cvspublic/xml-fop/src/org/apache/fop/messaging/Attic/MessageHandler.java,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 MessageHandler.java
--- src/org/apache/fop/messaging/MessageHandler.java17 Mar 2002 23:37:07 - 
 1.6.2.1
+++ src/org/apache/fop/messaging/MessageHandler.java19 Mar 2002 04:46:04 -
@@ -48,6 +48,7 @@
 public static final int EVENT = 2;
 public static final int NONE = 3;// this should always be the last method
 
+private static Logger logger = null;
 private static String logfileName = fop.log;
 private static PrintWriter writer;
 private static int outputMethod = SCREEN;
@@ -81,47 +82,47 @@
 }
 }
 
-// temp workaround
-private static Logger logger = null;
-
 /**
  * informs the user of the message
  * @param message the message for the user
  */
 public static void log(String message) {
-if (!quiet) {
-if(logger == null) {
-logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
-}
-setMessage(message);
-switch (outputMethod) {
-case SCREEN:
-logger.debug(getMessage());
-break;
-case FILE:
-if (fileOpened) {
-writer.print(getMessage());
-writer.flush();
-} else {
-openFile();
-writer.print(getMessage());
-writer.flush();
-}
-break;
-case EVENT:
-setMessage(message);
-Enumeration enum = listeners.elements();
-while (enum.hasMoreElements()) {
-((MessageListener)enum.nextElement()).processMessage(new 
MessageEvent(getMessage()));
-}
-break;
-case NONE:
-// do nothing
-break;
-default:
-logger.debug(message);
-}
-}
+if (quiet)
+   return;
+
+   if (logger == null) {
+   logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
+   logger.warn(Screen logger not set.);
+   }
+   
+   setMessage(message);
+   switch (outputMethod) {
+   case SCREEN:
+   logger.debug(getMessage());
+   break;
+   case FILE:
+   if (fileOpened) {
+   writer.print(getMessage());
+   writer.flush();
+   } else {
+   openFile();
+   writer.print(getMessage());
+   writer.flush();
+   }
+   break;
+   case EVENT:
+   setMessage(message);
+   Enumeration enum = listeners.elements();
+   while (enum.hasMoreElements()) {
+   ((MessageListener)enum.nextElement()).processMessage(new 
+MessageEvent(getMessage()));
+   }
+   break;
+   case NONE:
+   // do nothing
+   break;
+   default:
+   logger.debug(message);
+   }
 }
 
 /**
@@ -138,9 +139,11 @@
  */
 
 public static void error(String errorMessage) {
-if(logger == null) {
-logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
-}
+   if (logger == null) {
+   logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
+   logger.warn(Screen logger not set.);
+   }
+
 setMessage(errorMessage);
 switch (outputMethod) {
 case SCREEN:
@@ -195,6 +198,16 @@
  */
 public static void removeListener(MessageListener listener) {
 listeners.removeElement(listener);
+}
+
+/**
+ * Sets the Logger used for the screen output method.
+ * @param newLogger a logger for screen output. This may not be null.
+ */
+public static void setScreenLogger(Logger newLogger) {
+   if (newLogger == null)
+   throw new NullPointerException();
+   logger = newLogger;
 }
 
 /**
Index: src/org/apache/fop/apps/CommandLineOptions.java
===
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/apps/CommandLineOptions.java,v
retrieving revision