cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: quick question on logging and actions
Date Mon, 12 Mar 2001 21:40:20 GMT
Donald Ball wrote:
> 
> hiya. i'm trying my hand at writing a simple action to get a feel for the
> capabilities of the api. figured i'd start with a sendmail action. right
> now i'm trying to log some information but am having trouble off the bat
> because the log object doesn't exist. i'm extending AbstractAction. what
> interface (i'm guessing) should i be extending to get a reference to the
> log object? where does the log information end up (in catalina?)

AbstractAction extends AbstractLoggable (an Avalon convenience class).
To log all you have to do is:

getLogger().debug("message", exception);

The log messages end up in Cocoon's log file ($CONTEXT/WEB-INF/logs/cocoon.log),
but if the priority is ERROR or above, it is copied to the Servlet Engine's
log file.

My suggestion to you is to use "getLogger().info(message)" or "getLogger().warn(
message, exception)" while developing, and then change them to debug when all
is well.  The reason is that you will be able to set the "log-level" initial
parameter to "INFO", to filter out the miriad of debug messages to focus on
what you are working.  Also note, that I said to change them to debug when you
are done, so that this trick will continue to work.

Also, be generous with logging.  The LogKit package is very optimized, and
has only a marginal difference in performance between using it and not using
it.

Examine any of the number of concrete actions available.  Once you write one
or two, it becomes easier and easier.

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


Mime
View raw message