cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Ratcliffe" <>
Subject RE: use flow logger in my java functions
Date Sun, 05 Dec 2004 03:56:25 GMT
Hi Paul !

Avalon specifies component interfaces for separating the concerns of the
system, for example configuration, logging, execution etc. The lifecycle of
components implementing these interfaces is managed by the container and the
container is responsible for providing the component with its required
dependencies, in your case a logger.

The basic steps needed to setup your component to be provided with a logger

- Implement the LogEnabled interface
- Create a configuration file that identifies your component role, this has
the form:

  <role name="com.example.MyComp"

Reference your component roles in cocoon.xconf like this

<cocoon version="2.1" user-roles="/WEB-INF/user.roles">

- Declare the logger for your component in cocoon.xconf like this

<myComponent logger="flow">

Note the element name should be the same as the shorthand used for your
component in the user roles file and the element can be declared as a
top-level element anywhere in cocoon.xconf, AFAIK.

- Lookup your component in your flowscript:

var myComp = cocoon.getComponent("myComponent");

This will ensure that all implemented lifecycle methods are called when the
component is instantiated.

- Release your component when you're done:


Hope that helps,


-----Original Message-----
From: Paul Joseph []
Sent: Friday, 3 December 2004 4:04 a.m.
To: Cocoon Users
Subject: use flow logger in my java functions


I would like to enable the flowscript logger in some
of my java classes.

I looked at the wikki on using a logger in java and
the only thing not clear to me is this:

when I implement the LogEnabled interface with the
function enableLogging(Logger logger),

then, when I want to use it from Flow (Javascript), I
should go:


what should the argument loggerToUse be in the flow
script so that I can use the usual logger that is used
when I call say cocoon.log.warn("a message") in my


This communication, including attachments, is for the exclusive use of
the addressee and may contain proprietary, confidential, or privileged
information.  If you are not the intended recipient, any use, copying,
disclosure, dissemination, or distribution is strictly prohibited.  If
you are not the intended recipient, please notify the sender by return mail
and delete this communication and destroy all copies.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message