You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Steve Gibson <St...@cowww.com> on 2004/06/07 16:11:16 UTC

RE: [SPAM] - One more reason for exception commons-logging by default - Email has different SMTP TO: and MIME TO: fields in the email addresses

Tapestry DOES use commons-logging. Version 3.0 switched from log4J to
commons-logging.
I haven't done enough work with 3.0 yet to need any messages logged by
tapestry (errors in my code are logged by my code) but I used the
logging in 2.x a lot when I was learning how things work (especically
for contrib code).

>From the source for BaseComponent
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

<snip>

public class BaseComponent extends AbstractComponent
{
    private static final Log LOG =
LogFactory.getLog(BaseComponent.class);

Try setting your base logging level to DEBUG.
I have had problems recently with commons-logging where I only get log
levels at or above the root level. If I set the root level to DEBUG and
filter out those I don't want at DEBUG, then I get the messages I want.

Anyway, if you just set your root to DEBUG, you will see that Tapestry
uses commons-logging.

Steve Gibson

-----Original Message-----
From: Vjeran Marcinko [mailto:vjeran@tis.hr] 
Sent: Monday, June 07, 2004 9:52 AM
To: tapestry-user@jakarta.apache.org
Subject: [SPAM] - One more reason for exception commons-logging by
default - Email has different SMTP TO: and MIME TO: fields in the email
addresses


Hi.

Few days ago, I posted about problem of not logging exceptions through
commons-logging by default, and need for it in production environment.
Currently, there is at least solution to register my own Exception page,
and
place exception logging logic inside it :

public class MyExceptionPage extends BasePage {
    private final Log logger = LogFactory.getLog(MyExceptionPage.class);

    public void setException(Throwable throwable) {
        logger.error("Runtime exception raised", throwable);
    }
}


But I don't consider it a good choice for Tapestry's end users, since
some
exceptions don't return cause exception by typical method getCause(),
such
as OgnlException, so code above would only log upper exceptions in
chain,
and not root exception that caused raising exceptions.
And I think that asking end users to add in class above logic such as :
if (throwable instanceof OgnlException) {
    Throwable lowerThrowable = ((OgnlException) throwable).getReason();
    ...some additional logging...
}
is unacceptably complicated just to get damn exception logged...

-Vjeran


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: One more reason for exception commons-logging by default

Posted by Vjeran Marcinko <vj...@tis.hr>.
No good also, although I didn't know that Tapestry logs these exception at
DEBUG level.
First, it would be troublesome to filter out these exceptions - they are
simply logged in AbstractEngine on DEBUG level as lots of other
"uninteresting" stuff.
And second, this exception logging suffers from the same problem that I have
writen before - it doesn't log root cause from OgnlExceptions since they
don't follow common pattern - to have getCause() method for returning cause
exception, but use getReason() method. Thus, I only get upper exceptions.
Default Exception page presents nicely all exceptions in a chain, but as I
said, this page error reporting is insufficient for production.

-Vjeran

----- Original Message ----- 
From: "Steve Gibson" <St...@cowww.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, June 07, 2004 4:11 PM
Subject: RE: [SPAM] - One more reason for exception commons-logging by
default - Email has different SMTP TO: and MIME TO: fields in the email
addresses


Tapestry DOES use commons-logging. Version 3.0 switched from log4J to
commons-logging.
I haven't done enough work with 3.0 yet to need any messages logged by
tapestry (errors in my code are logged by my code) but I used the
logging in 2.x a lot when I was learning how things work (especically
for contrib code).

>From the source for BaseComponent
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

<snip>

public class BaseComponent extends AbstractComponent
{
    private static final Log LOG =
LogFactory.getLog(BaseComponent.class);

Try setting your base logging level to DEBUG.
I have had problems recently with commons-logging where I only get log
levels at or above the root level. If I set the root level to DEBUG and
filter out those I don't want at DEBUG, then I get the messages I want.

Anyway, if you just set your root to DEBUG, you will see that Tapestry
uses commons-logging.

Steve Gibson

-----Original Message-----
From: Vjeran Marcinko [mailto:vjeran@tis.hr]
Sent: Monday, June 07, 2004 9:52 AM
To: tapestry-user@jakarta.apache.org
Subject: [SPAM] - One more reason for exception commons-logging by
default - Email has different SMTP TO: and MIME TO: fields in the email
addresses


Hi.

Few days ago, I posted about problem of not logging exceptions through
commons-logging by default, and need for it in production environment.
Currently, there is at least solution to register my own Exception page,
and
place exception logging logic inside it :

public class MyExceptionPage extends BasePage {
    private final Log logger = LogFactory.getLog(MyExceptionPage.class);

    public void setException(Throwable throwable) {
        logger.error("Runtime exception raised", throwable);
    }
}


But I don't consider it a good choice for Tapestry's end users, since
some
exceptions don't return cause exception by typical method getCause(),
such
as OgnlException, so code above would only log upper exceptions in
chain,
and not root exception that caused raising exceptions.
And I think that asking end users to add in class above logic such as :
if (throwable instanceof OgnlException) {
    Throwable lowerThrowable = ((OgnlException) throwable).getReason();
    ...some additional logging...
}
is unacceptably complicated just to get damn exception logged...

-Vjeran


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org