You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@locus.apache.org on 2000/11/14 16:08:29 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/servlet CocoonServlet.java

bloritsch    00/11/14 07:08:28

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Main.java
               src/org/apache/cocoon/acting Tag: xml-cocoon2
                        HelloAction.java
               src/org/apache/cocoon/generation Tag: xml-cocoon2
                        StatusGenerator.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
  Log:
  Fixed some errors with Command Line interpretation, and incorporated Avalon logging in the same location as Servlet logging.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.14  +32 -24    xml-cocoon/src/org/apache/cocoon/Attic/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Main.java,v
  retrieving revision 1.1.4.13
  retrieving revision 1.1.4.14
  diff -u -r1.1.4.13 -r1.1.4.14
  --- Main.java	2000/11/10 22:38:52	1.1.4.13
  +++ Main.java	2000/11/14 15:08:26	1.1.4.14
  @@ -45,7 +45,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.4.13 $ $Date: 2000/11/10 22:38:52 $
  + * @version CVS $Revision: 1.1.4.14 $ $Date: 2000/11/14 15:08:26 $
    */
   
   public class Main {
  @@ -99,12 +99,9 @@
           String workDir = Cocoon.DEFAULT_WORK_DIR;
           List targets = new ArrayList();
           CLArgsParser parser = new CLArgsParser(args, options);
  -        String logUrl = "";
  -        String unprocessed[];
  +        String logUrl = "file://./logs/cocoon.log";
           String logLevel = "DEBUG";
   
  -        LogKit.setGlobalPriority(Priority.DEBUG);
  -
           List clOptions = parser.getArguements();
           int size = clOptions.size();
   
  @@ -113,7 +110,7 @@
   
               switch (option.getId()) {
                   case 0:
  -                    LogKit.log("Sorry, cannot recognize the argument: \'" + option.getId() + "\'\n");
  +                    targets.add(option.getArguement());
                       break;
   
                   case Main.HELP_OPT:
  @@ -146,40 +143,43 @@
               }
           }
   
  -        unprocessed = parser.getUnparsedArgs();
  -        for (int i = 0; i < unprocessed.length; i++) {
  -            targets.add(unprocessed[i]);
  -        }
  -
           try {
  +            LogKit.setGlobalPriority(LogKit.getPriorityForName(logLevel));
  +
               log = LogKit.createLogger("cocoon", logUrl, logLevel);
           } catch (MalformedURLException mue) {
  -            LogKit.log("Cannot write on the specified log file. " +
  -                        "Please, make sure the path exists and you have write permissions.",
  -                        mue);
  +            String error = "Cannot write on the specified log file.  Please, make sure the path exists and you have write permissions.";
  +            LogKit.log(error, mue);
  +            System.out.println(error);
  +            mue.printStackTrace(System.err);
               System.exit(1);
           }
   
           if (destDir.equals("")) {
  -            log.fatalError("Careful, you must specify a destination dir when " +
  -                        "using the -d/--destDir argument");
  +            String error = "Careful, you must specify a destination dir when using the -d/--destDir argument";
  +            log.fatalError(error);
  +            System.out.println(error);
               System.exit(1);
           }
   
           if (contextDir.equals("")) {
  -            log.error("Careful, you must specify a configuration file when " +
  -                        "using the -c/--contextDir argument");
  +            String error = "Careful, you must specify a configuration file when using the -c/--contextDir argument";
  +            log.error(error);
  +            System.out.println(error);
               System.exit(1);
           }
   
           if (workDir.equals("")) {
  -            log.error("Careful, you must specify a destination dir when " +
  -                        "using the -w/--workDir argument");
  +            String error = "Careful, you must specify a destination dir when using the -w/--workDir argument";
  +            log.error(error);
  +            System.out.println(error);
               System.exit(1);
           }
   
           if (targets.size() == 0) {
  -            log.error("Please, specify at least one starting URI.");
  +            String error = "Please, specify at least one starting URI.";
  +            log.error(error);
  +            System.out.println(error);
               System.exit(1);
           }
   
  @@ -189,10 +189,7 @@
               File context = getDir(contextDir, "context");
               File conf = getConfigurationFile(context);
               Main main = new Main(new Cocoon(conf, null, work.toString()), context, dest);
  -            log.info("Warming up...");
  -            log.info(" [Cocoon might need to compile the sitemaps, this might take a while]");
               main.warmup();
  -            log.info("...ready, let's go:");
               main.process(targets);
               log.info("Done");
           } catch (Exception e) {
  @@ -223,33 +220,41 @@
   
       private static File getConfigurationFile(File dir) throws Exception {
   
  +        log.debug("Trying configuration file at: " + Cocoon.DEFAULT_CONF_FILE);
           File f = new File(dir, Cocoon.DEFAULT_CONF_FILE);
           if (f.canRead()) return f;
   
  +        log.debug("Trying configuration file at: " + System.getProperty("user.dir") + File.separator + Cocoon.DEFAULT_CONF_FILE);
           f = new File(System.getProperty("user.dir") + File.separator + Cocoon.DEFAULT_CONF_FILE);
           if (f.canRead()) return f;
   
  +        log.debug("Trying configuration file at: /usr/local/etc/" + Cocoon.DEFAULT_CONF_FILE);
           f = new File("/usr/local/etc/" + Cocoon.DEFAULT_CONF_FILE);
           if (f.canRead()) return f;
   
  +        log.error("Could not find the configuration file.");
           throw new FileNotFoundException("The configuration file could not be found.");
       }
   
       private static File getDir(String dir, String type) throws Exception {
   
  +        log.debug("Getting handle to " + type + " directory '" + dir + "'");
           File d = new File(dir);
   
           if (!d.exists()) {
               if (!d.mkdirs()) {
  +                log.error("Error creating " + type + " directory '" + d + "'");
                   throw new IOException("Error creating " + type + " directory '" + d + "'");
               }
           }
   
           if (!d.isDirectory()) {
  +            log.error("'" + d + "' is not a directory.");
               throw new IOException("'" + d + "' is not a directory.");
           }
   
           if (!(d.canRead() && d.canWrite())) {
  +            log.error("Directory '" + d + "' is not readable/writable");
               throw new IOException("Directory '" + d + "' is not readable/writable");
           }
   
  @@ -277,6 +282,8 @@
        * Warms up the engine by accessing the root.
        */
       public void warmup() throws Exception {
  +        log.info("Warming up...");
  +        log.info(" [Cocoon might need to compile the sitemaps, this might take a while]");
           cocoon.process(new LinkSamplingEnvironment("/", context, attributes, null));
       }
   
  @@ -284,6 +291,7 @@
        * Process the URI list and process them all independently.
        */
       public void process(Collection uris) throws Exception {
  +        log.info("...ready, let's go:");
           Iterator i = uris.iterator();
           while (i.hasNext()) {
               this.processURI(NetUtils.normalize((String) i.next()), 0);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +4 -1      xml-cocoon/src/org/apache/cocoon/acting/Attic/HelloAction.java
  
  Index: HelloAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/HelloAction.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- HelloAction.java	2000/11/10 22:38:52	1.1.2.4
  +++ HelloAction.java	2000/11/14 15:08:27	1.1.2.5
  @@ -26,7 +26,7 @@
   /**
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/11/10 22:38:52 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/14 15:08:27 $
    */
   public class HelloAction implements Action {
   
  @@ -44,11 +44,14 @@
               if (context != null) {
                   if (session != null) {
                       if (session.isNew()) {
  +                        log.debug("Session is new");
                           context.log("Session is new");
                       } else {
  +                        log.debug("Session is new");
                           context.log("Session is old");
                       }
                   } else {
  +                    log.debug("A session object was not created");
                       context.log("A session object was not created");
                   }
               } else {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +177 -177  xml-cocoon/src/org/apache/cocoon/generation/Attic/StatusGenerator.java
  
  Index: StatusGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/StatusGenerator.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- StatusGenerator.java	2000/08/21 17:37:53	1.1.2.4
  +++ StatusGenerator.java	2000/11/14 15:08:27	1.1.2.5
  @@ -47,189 +47,189 @@
    * &lt;!ELEMENT line (#PCDATA)+&gt;
    * &gt;
    * </code>
  - * 
  + *
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a> (Luminas Limited)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/08/21 17:37:53 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/14 15:08:27 $
    */
   public class StatusGenerator extends ComposerGenerator {
   
  -	/** The XML namespace for the output document.
  -	 */
  -	protected static final String namespace =
  -		"http://apache.org/cocoon/2.0/status";
  -
  -	/** The XML namespace for xlink
  -	 */
  -	protected static final String xlinkNamespace =
  -		"http://www.w3.org/1999/xlink";
  -		
  -	/** Generate the status information in XML format.
  -	 * @throws SAXException
  -	 *	when there is a problem creating the output SAX events.
  -	 */
  -	public void generate() throws SAXException {
  -	
  -		// Start the document and set the namespace.
  -		this.contentHandler.startDocument();
  -		this.contentHandler.startPrefixMapping("", namespace);
  -		this.contentHandler.startPrefixMapping("xlink", xlinkNamespace);
  -
  -		genStatus(this.contentHandler);
  -
  -		// End the document.
  -		this.contentHandler.endPrefixMapping("xlink");
  -		this.contentHandler.endPrefixMapping("");
  -		this.contentHandler.endDocument();
  -	}
  -
  -	/** Generate the main status document.
  -	 */
  -	private void genStatus(ContentHandler ch) throws SAXException {
  -		// Root element.
  -
  -		// The current date and time.
  -		String dateTime = DateFormat.getDateTimeInstance().format(new Date());
  -
  -		String localHost;
  -
  -		// The local host.
  -		try {
  -			localHost = InetAddress.getLocalHost().getHostName();
  -		} catch ( UnknownHostException e ) {
  -			localHost = "";
  -		} catch ( SecurityException e ) {
  -			localHost = "";
  -		}
  -		
  -		AttributesImpl atts = new AttributesImpl();
  -		atts.addAttribute(namespace, "date", "date", "CDATA", dateTime);
  -		atts.addAttribute(namespace, "host", "host", "CDATA", localHost);
  -		ch.startElement(namespace, "statusinfo", "statusinfo", atts);
  -
  -		genVMStatus(ch);
  -
  -		// End root element.
  -		ch.endElement(namespace, "statusinfo", "statusinfo");
  -	}
  -
  -	private void genVMStatus(ContentHandler ch) throws SAXException {
  -		String buf;
  -		AttributesImpl atts = new AttributesImpl();
  -	
  -		startGroup(ch, "vm");
  -		// BEGIN Memory status
  -		startGroup(ch, "memory");
  -		addValue(ch, "total", String.valueOf(Runtime.getRuntime().totalMemory()));
  -		addValue(ch, "free", String.valueOf(Runtime.getRuntime().freeMemory()));
  -		endGroup(ch);
  -		// END Memory status
  -		
  -		// BEGIN JRE
  -		startGroup(ch, "jre");
  -		addValue(ch, "version", System.getProperty("java.version"));
  -		atts.clear();
  -		atts.addAttribute(xlinkNamespace, "type", "type", "CDATA", "simple");
  -		atts.addAttribute(xlinkNamespace, "href", "href", "CDATA",
  -			System.getProperty("java.vendor.url") );
  -		addValue(ch, "java-vendor", System.getProperty("java.vendor"), atts);
  -		endGroup(ch);
  -		// END JRE
  -		
  -		// BEGIN Operating system
  -		startGroup(ch, "operating-system");
  -		addValue(ch, "name", System.getProperty("os.name"));
  -		addValue(ch, "architecture", System.getProperty("os.arch"));
  -		addValue(ch, "version", System.getProperty("os.version"));
  -		endGroup(ch);
  -		// END operating system
  -		
  -		String classpath = System.getProperty("java.class.path");
  -		List paths = new ArrayList();
  -		StringTokenizer tokenizer = new StringTokenizer(classpath, System.getProperty("path.separator"));
  -		while (tokenizer.hasMoreTokens()) {
  -		    paths.add(tokenizer.nextToken());
  -		}
  -		addMultilineValue(ch, "classpath", paths);
  -
  -		// BEGIN OS info
  -		endGroup(ch);
  -	}
  -
  -	/** Utility function to begin a <code>group</code> tag pair. */
  -	private void startGroup(ContentHandler ch, String name) throws SAXException {
  -		startGroup(ch, name, null);
  -	}
  -	
  -	/** Utility function to begin a <code>group</code> tag pair with added attributes. */
  -	private void startGroup(ContentHandler ch, String name, Attributes atts) throws SAXException {
  -		AttributesImpl ai;
  -		if ( atts == null ) {
  -			ai = new AttributesImpl();
  -		} else {
  -			ai = new AttributesImpl(atts);
  -		}
  -		ai.addAttribute(namespace, "name", "name", "CDATA", name);
  -		ch.startElement(namespace, "group", "group", ai);
  -	}
  -
  -	/** Utility function to end a <code>group</code> tag pair. */
  -	private void endGroup(ContentHandler ch) throws SAXException {
  -		ch.endElement(namespace, "group", "group");
  -	}
  -
  -	/** Utility function to begin and end a <code>value</code> tag pair. */
  -	private void addValue(ContentHandler ch, String name, String value) throws SAXException {
  -		addValue(ch, name, value, null);
  -	}
  -
  -	/** Utility function to begin and end a <code>value</code> tag pair with added attributes. */
  -	private void addValue(ContentHandler ch, String name, String value, Attributes atts) throws SAXException {
  -		AttributesImpl ai;
  -		if ( atts == null ) {
  -			ai = new AttributesImpl();
  -		} else {
  -			ai = new AttributesImpl(atts);
  -		}
  -		ai.addAttribute(namespace, "name", "name", "CDATA", name);
  -		ch.startElement(namespace, "value", "value", ai);
  -		ch.startElement(namespace, "line", "line", new AttributesImpl());
  -
  -    	if ( value != null ) {
  -			ch.characters(value.toCharArray(), 0, value.length());
  -		}
  -
  -		ch.endElement(namespace, "line", "line");
  -		ch.endElement(namespace, "value", "value");
  -	}
  -
  -	/** Utility function to begin and end a <code>value</code> tag pair. */
  -	private void addMultilineValue(ContentHandler ch, String name, List values) throws SAXException {
  -		addMultilineValue(ch, name, values, null);
  -	}
  -	
  -	/** Utility function to begin and end a <code>value</code> tag pair with added attributes. */
  -	private void addMultilineValue(ContentHandler ch, String name, List values, Attributes atts) throws SAXException {
  -		AttributesImpl ai;
  -		if ( atts == null ) {
  -			ai = new AttributesImpl();
  -		} else {
  -			ai = new AttributesImpl(atts);
  -		}
  -		ai.addAttribute(namespace, "name", "name", "CDATA", name);
  -		ch.startElement(namespace, "value", "value", ai);
  +    /** The XML namespace for the output document.
  +     */
  +    protected static final String namespace =
  +        "http://apache.org/cocoon/2.0/status";
  +
  +    /** The XML namespace for xlink
  +     */
  +    protected static final String xlinkNamespace =
  +        "http://www.w3.org/1999/xlink";
  +
  +    /** Generate the status information in XML format.
  +     * @throws SAXException
  +     *         when there is a problem creating the output SAX events.
  +     */
  +    public void generate() throws SAXException {
  +
  +        // Start the document and set the namespace.
  +        this.contentHandler.startDocument();
  +        this.contentHandler.startPrefixMapping("", namespace);
  +        this.contentHandler.startPrefixMapping("xlink", xlinkNamespace);
  +
  +        genStatus(this.contentHandler);
  +
  +        // End the document.
  +        this.contentHandler.endPrefixMapping("xlink");
  +        this.contentHandler.endPrefixMapping("");
  +        this.contentHandler.endDocument();
  +    }
  +
  +    /** Generate the main status document.
  +     */
  +    private void genStatus(ContentHandler ch) throws SAXException {
  +        // Root element.
  +
  +        // The current date and time.
  +        String dateTime = DateFormat.getDateTimeInstance().format(new Date());
  +
  +        String localHost;
  +
  +        // The local host.
  +        try {
  +            localHost = InetAddress.getLocalHost().getHostName();
  +        } catch ( UnknownHostException e ) {
  +            localHost = "";
  +        } catch ( SecurityException e ) {
  +            localHost = "";
  +        }
  +
  +        AttributesImpl atts = new AttributesImpl();
  +        atts.addAttribute(namespace, "date", "date", "CDATA", dateTime);
  +        atts.addAttribute(namespace, "host", "host", "CDATA", localHost);
  +        ch.startElement(namespace, "statusinfo", "statusinfo", atts);
  +
  +        genVMStatus(ch);
  +
  +        // End root element.
  +        ch.endElement(namespace, "statusinfo", "statusinfo");
  +    }
  +
  +    private void genVMStatus(ContentHandler ch) throws SAXException {
  +        String buf;
  +        AttributesImpl atts = new AttributesImpl();
  +
  +        startGroup(ch, "vm");
  +        // BEGIN Memory status
  +        startGroup(ch, "memory");
  +        addValue(ch, "total", String.valueOf(Runtime.getRuntime().totalMemory()));
  +        addValue(ch, "free", String.valueOf(Runtime.getRuntime().freeMemory()));
  +        endGroup(ch);
  +        // END Memory status
  +
  +        // BEGIN JRE
  +        startGroup(ch, "jre");
  +        addValue(ch, "version", System.getProperty("java.version"));
  +        atts.clear();
  +        atts.addAttribute(xlinkNamespace, "type", "type", "CDATA", "simple");
  +        atts.addAttribute(xlinkNamespace, "href", "href", "CDATA",
  +            System.getProperty("java.vendor.url") );
  +        addValue(ch, "java-vendor", System.getProperty("java.vendor"), atts);
  +        endGroup(ch);
  +        // END JRE
  +
  +        // BEGIN Operating system
  +        startGroup(ch, "operating-system");
  +        addValue(ch, "name", System.getProperty("os.name"));
  +        addValue(ch, "architecture", System.getProperty("os.arch"));
  +        addValue(ch, "version", System.getProperty("os.version"));
  +        endGroup(ch);
  +        // END operating system
  +
  +        String classpath = System.getProperty("java.class.path");
  +        List paths = new ArrayList();
  +        StringTokenizer tokenizer = new StringTokenizer(classpath, System.getProperty("path.separator"));
  +        while (tokenizer.hasMoreTokens()) {
  +            paths.add(tokenizer.nextToken());
  +        }
  +        addMultilineValue(ch, "classpath", paths);
  +
  +        // BEGIN OS info
  +        endGroup(ch);
  +    }
  +
  +    /** Utility function to begin a <code>group</code> tag pair. */
  +    private void startGroup(ContentHandler ch, String name) throws SAXException {
  +        startGroup(ch, name, null);
  +    }
  +
  +    /** Utility function to begin a <code>group</code> tag pair with added attributes. */
  +    private void startGroup(ContentHandler ch, String name, Attributes atts) throws SAXException {
  +        AttributesImpl ai;
  +        if ( atts == null ) {
  +            ai = new AttributesImpl();
  +        } else {
  +            ai = new AttributesImpl(atts);
  +        }
  +        ai.addAttribute(namespace, "name", "name", "CDATA", name);
  +        ch.startElement(namespace, "group", "group", ai);
  +    }
  +
  +    /** Utility function to end a <code>group</code> tag pair. */
  +    private void endGroup(ContentHandler ch) throws SAXException {
  +        ch.endElement(namespace, "group", "group");
  +    }
  +
  +    /** Utility function to begin and end a <code>value</code> tag pair. */
  +    private void addValue(ContentHandler ch, String name, String value) throws SAXException {
  +        addValue(ch, name, value, null);
  +    }
  +
  +    /** Utility function to begin and end a <code>value</code> tag pair with added attributes. */
  +    private void addValue(ContentHandler ch, String name, String value, Attributes atts) throws SAXException {
  +        AttributesImpl ai;
  +        if ( atts == null ) {
  +            ai = new AttributesImpl();
  +        } else {
  +            ai = new AttributesImpl(atts);
  +        }
  +        ai.addAttribute(namespace, "name", "name", "CDATA", name);
  +        ch.startElement(namespace, "value", "value", ai);
  +        ch.startElement(namespace, "line", "line", new AttributesImpl());
  +
  +        if ( value != null ) {
  +            ch.characters(value.toCharArray(), 0, value.length());
  +        }
  +
  +        ch.endElement(namespace, "line", "line");
  +        ch.endElement(namespace, "value", "value");
  +    }
  +
  +    /** Utility function to begin and end a <code>value</code> tag pair. */
  +    private void addMultilineValue(ContentHandler ch, String name, List values) throws SAXException {
  +        addMultilineValue(ch, name, values, null);
  +    }
  +
  +    /** Utility function to begin and end a <code>value</code> tag pair with added attributes. */
  +    private void addMultilineValue(ContentHandler ch, String name, List values, Attributes atts) throws SAXException {
  +        AttributesImpl ai;
  +        if ( atts == null ) {
  +            ai = new AttributesImpl();
  +        } else {
  +            ai = new AttributesImpl(atts);
  +        }
  +        ai.addAttribute(namespace, "name", "name", "CDATA", name);
  +        ch.startElement(namespace, "value", "value", ai);
   
           for (int i = 0; i < values.size(); i++) {
               String value = (String) values.get(i);
  -    	    if ( value != null ) {
  -        		ch.startElement(namespace, "line", "line", new AttributesImpl());
  -			    ch.characters(value.toCharArray(), 0, value.length());
  -        		ch.endElement(namespace, "line", "line");
  -		    }
  -		}
  -
  -		ch.endElement(namespace, "value", "value");
  -	    
  -	}
  +            if ( value != null ) {
  +                ch.startElement(namespace, "line", "line", new AttributesImpl());
  +                ch.characters(value.toCharArray(), 0, value.length());
  +                ch.endElement(namespace, "line", "line");
  +            }
  +        }
  +
  +        ch.endElement(namespace, "value", "value");
  +
  +    }
   }
  - 
  +
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.27  +10 -3     xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
  retrieving revision 1.1.4.26
  retrieving revision 1.1.4.27
  diff -u -r1.1.4.26 -r1.1.4.27
  --- CocoonServlet.java	2000/11/13 21:17:31	1.1.4.26
  +++ CocoonServlet.java	2000/11/14 15:08:28	1.1.4.27
  @@ -47,7 +47,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
  - * @version CVS $Revision: 1.1.4.26 $ $Date: 2000/11/13 21:17:31 $
  + * @version CVS $Revision: 1.1.4.27 $ $Date: 2000/11/14 15:08:28 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -72,12 +72,12 @@
       public void init(ServletConfig conf) throws ServletException {
   
           try {
  -            log = LogKit.createLogger("cocoon", new URL("file:logs/cocoon.log"), Priority.INFO);
  +            log = LogKit.createLogger("cocoon", new URL("file://./logs/cocoon.log"), Priority.DEBUG);
           } catch (MalformedURLException mue) {
               LogKit.log("Could not set up Cocoon Logger, will use screen instead", mue);
           }
   
  -        LogKit.setGlobalPriority(Priority.INFO);
  +        LogKit.setGlobalPriority(Priority.DEBUG);
   
           super.init(conf);
   
  @@ -112,12 +112,14 @@
           if (configFileName == null) {
               throw new ServletException("Servlet initialization argument 'configurations' not specified");
           } else {
  +            log.info("Using configuration file: " + configFileName);
               this.context.log("Using configuration file: " + configFileName);
           }
   
           try {
               this.configFile = new File(this.context.getResource(configFileName).getFile());
           } catch (java.net.MalformedURLException mue) {
  +            log.error("Servlet initialization argument 'configurations' not found at " + configFileName, mue);
               throw new ServletException("Servlet initialization argument 'configurations' not found at " + configFileName);
           }
   
  @@ -139,15 +141,18 @@
           synchronized (this) {
               if (this.cocoon != null) {
                   if (this.cocoon.modifiedSince(this.creationTime)) {
  +                    log.info("Configuration changed reload attempt");
                       this.context.log("Configuration changed reload attempt");
                       this.cocoon = this.create();
                       reloaded    = true;
                   } else if ((req.getPathInfo() == null) && (req.getParameter(Cocoon.RELOAD_PARAM) != null)) {
  +                    log.info("Forced reload attempt");
                       this.context.log("Forced reload attempt");
                       this.cocoon = this.create();
                       reloaded    = true;
                   }
               } else if ((req.getPathInfo() == null) && (req.getParameter(Cocoon.RELOAD_PARAM) != null)) {
  +                log.info("Invalid configurations reload");
                   this.context.log("Invalid configurations reload");
                   this.cocoon = this.create();
                   reloaded    = true;
  @@ -237,11 +242,13 @@
   
       private Cocoon create() {
           try {
  +            log.info("Reloading from: " + this.configFile);
               this.context.log("Reloading from: " + this.configFile);
               Cocoon c = new Cocoon(this.configFile, this.classpath, this.workDir);
               this.creationTime = System.currentTimeMillis();
               return c;
           } catch (Exception e) {
  +            log.error("Exception reloading", e);
               this.context.log("Exception reloading: " + e.getMessage());
               this.exception = e;
               return null;