You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Lichtenberger <Jo...@uni-konstanz.de> on 2009/12/10 19:15:53 UTC

log4j issues...

Hello,

I'm still trying to catch errors with my logger, now I've even tried the
following:

  static { 
GoogleEarthGenerator.class.getResource("rcl-config/WEB-INF/log4j.xml");
  }
  
  /** Logger (commons-logging). */
  private Log logger = LogFactory.getLog(getClass().getName());

but I'm always receiving the following warning (which occurs because it
can't find log4j.xml..., somehow even not when copied to the mysite
project directory root).

Would be great if someone could help me, please. It seems some errors
are caught in cocoon.log and some aren't.

My general logging concept of errors is like the following, so I'm
getting a short message _and_ the stacktrace.

    } catch (SAXException e) {
      logger.warn("SAX exception: " + e.getMessage(), e);
    } catch (TreetankIOException e) {
      logger.warn("TreeTank IO exception: " + e.getMessage(), e);
    } catch (TreetankException e) {
      logger.warn("General Treetank exception: " + e.getMessage(), e);
    }

All I can see on STDOUT is about 100 lines like:

	at
org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
	at
org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
	at
org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)

but I have no clue on what's the kind of exception thrown and the
stacktrace and so on, all I know is the line (178, which is a recursive
call of the method "skip(...)").

regards,
Johannes


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: log4j issues...

Posted by Robby Pelssers <ro...@ciber.com>.
If you used the maven archetype to create a webapp block there should be a src/main/webapp/WEB-INF/log4j.xml

Mine looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="CORE" class="org.apache.log4j.FileAppender"> 
    <param name="File"   value="${spider.catalinaDirPath}/logs/productinformation.log" />  
    <param name="Append" value="false" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p %t %c - %m%n"/>
    </layout>
  </appender>

  <root>
    <priority value="${spider.loglevel}"/>
    <appender-ref ref="CORE"/>
  </root>
</log4j:configuration>

Kind regards,
Robby Pelssers

-----Original Message-----
From: Johannes Lichtenberger [mailto:Johannes.Lichtenberger@uni-konstanz.de] 
Sent: Friday, December 11, 2009 1:46 AM
To: users@cocoon.apache.org
Subject: Re: log4j issues...

On Fri, 2009-12-11 at 00:50 +0100, Steven Dolg wrote:
> Johannes Lichtenberger schrieb:
> > Hello,
> >
> > I'm still trying to catch errors with my logger, now I've even tried the
> > following:
> >
> >   static { 
> > GoogleEarthGenerator.class.getResource("rcl-config/WEB-INF/log4j.xml");
> >   }
> >   
> >   /** Logger (commons-logging). */
> >   private Log logger = LogFactory.getLog(getClass().getName());
> >
> > but I'm always receiving the following warning (which occurs because it
> > can't find log4j.xml..., somehow even not when copied to the mysite
> > project directory root).
> >   
> 
> Unless you are using some helper to configure log4j for you (eg like 
> org.apache.cocoon.spring.configurator.log4j.Log4JConfigurator) log4j 
> will look for a configuration in the classpath.
> So you might want that file in WEB-INF/classes.
> And there is no need to access it from your own code.

Hm, I have no directory named classes within WEB-INF, but see below.

> > Would be great if someone could help me, please. It seems some errors
> > are caught in cocoon.log and some aren't.
> >
> > My general logging concept of errors is like the following, so I'm
> > getting a short message _and_ the stacktrace.
> >
> >     } catch (SAXException e) {
> >       logger.warn("SAX exception: " + e.getMessage(), e);
> >     } catch (TreetankIOException e) {
> >       logger.warn("TreeTank IO exception: " + e.getMessage(), e);
> >     } catch (TreetankException e) {
> >       logger.warn("General Treetank exception: " + e.getMessage(), e);
> >     }
> >
> > All I can see on STDOUT is about 100 lines like:
> >
> > 	at
> > org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
> > 	at
> > org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
> > 	at
> > org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
> >
> > but I have no clue on what's the kind of exception thrown and the
> > stacktrace and so on, all I know is the line (178, which is a recursive
> > call of the method "skip(...)").
> >   
> 
> Looks like your recursion is too deep and you're getting a 
> StackOverflowError.

Oh yes, exactly, after adding a static-Block with some initialisation
which should only be done once so I get the stack trace after a second
call to http://localhost:8888/gearth/?BBOX=1,1,1,1.

Do you know how to configure the JVM used (enable assertions -- -vmargs
-ea)?

Thank you.

regards,
Johannes


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: log4j issues...

Posted by Johannes Lichtenberger <Jo...@uni-konstanz.de>.
On Fri, 2009-12-11 at 00:50 +0100, Steven Dolg wrote:
> Johannes Lichtenberger schrieb:
> > Hello,
> >
> > I'm still trying to catch errors with my logger, now I've even tried the
> > following:
> >
> >   static { 
> > GoogleEarthGenerator.class.getResource("rcl-config/WEB-INF/log4j.xml");
> >   }
> >   
> >   /** Logger (commons-logging). */
> >   private Log logger = LogFactory.getLog(getClass().getName());
> >
> > but I'm always receiving the following warning (which occurs because it
> > can't find log4j.xml..., somehow even not when copied to the mysite
> > project directory root).
> >   
> 
> Unless you are using some helper to configure log4j for you (eg like 
> org.apache.cocoon.spring.configurator.log4j.Log4JConfigurator) log4j 
> will look for a configuration in the classpath.
> So you might want that file in WEB-INF/classes.
> And there is no need to access it from your own code.

Hm, I have no directory named classes within WEB-INF, but see below.

> > Would be great if someone could help me, please. It seems some errors
> > are caught in cocoon.log and some aren't.
> >
> > My general logging concept of errors is like the following, so I'm
> > getting a short message _and_ the stacktrace.
> >
> >     } catch (SAXException e) {
> >       logger.warn("SAX exception: " + e.getMessage(), e);
> >     } catch (TreetankIOException e) {
> >       logger.warn("TreeTank IO exception: " + e.getMessage(), e);
> >     } catch (TreetankException e) {
> >       logger.warn("General Treetank exception: " + e.getMessage(), e);
> >     }
> >
> > All I can see on STDOUT is about 100 lines like:
> >
> > 	at
> > org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
> > 	at
> > org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
> > 	at
> > org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
> >
> > but I have no clue on what's the kind of exception thrown and the
> > stacktrace and so on, all I know is the line (178, which is a recursive
> > call of the method "skip(...)").
> >   
> 
> Looks like your recursion is too deep and you're getting a 
> StackOverflowError.

Oh yes, exactly, after adding a static-Block with some initialisation
which should only be done once so I get the stack trace after a second
call to http://localhost:8888/gearth/?BBOX=1,1,1,1.

Do you know how to configure the JVM used (enable assertions -- -vmargs
-ea)?

Thank you.

regards,
Johannes


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: log4j issues...

Posted by Steven Dolg <st...@indoqa.com>.
Johannes Lichtenberger schrieb:
> Hello,
>
> I'm still trying to catch errors with my logger, now I've even tried the
> following:
>
>   static { 
> GoogleEarthGenerator.class.getResource("rcl-config/WEB-INF/log4j.xml");
>   }
>   
>   /** Logger (commons-logging). */
>   private Log logger = LogFactory.getLog(getClass().getName());
>
> but I'm always receiving the following warning (which occurs because it
> can't find log4j.xml..., somehow even not when copied to the mysite
> project directory root).
>   

Unless you are using some helper to configure log4j for you (eg like 
org.apache.cocoon.spring.configurator.log4j.Log4JConfigurator) log4j 
will look for a configuration in the classpath.
So you might want that file in WEB-INF/classes.
And there is no need to access it from your own code.

> Would be great if someone could help me, please. It seems some errors
> are caught in cocoon.log and some aren't.
>
> My general logging concept of errors is like the following, so I'm
> getting a short message _and_ the stacktrace.
>
>     } catch (SAXException e) {
>       logger.warn("SAX exception: " + e.getMessage(), e);
>     } catch (TreetankIOException e) {
>       logger.warn("TreeTank IO exception: " + e.getMessage(), e);
>     } catch (TreetankException e) {
>       logger.warn("General Treetank exception: " + e.getMessage(), e);
>     }
>
> All I can see on STDOUT is about 100 lines like:
>
> 	at
> org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
> 	at
> org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
> 	at
> org.treetank.cocoon.generating.GoogleEarthGenerator.skip(GoogleEarthGenerator.java:178)
>
> but I have no clue on what's the kind of exception thrown and the
> stacktrace and so on, all I know is the line (178, which is a recursive
> call of the method "skip(...)").
>   

Looks like your recursion is too deep and you're getting a 
StackOverflowError.

> regards,
> Johannes
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org