cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Ratcliffe" <a...@mrigitech.com>
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
are:

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

<role-list>
  <role name="com.example.MyComp"
	shorthand="myComponent"
	default-class="com.example.MyCompImpl"/>
</role-list>

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:

cocoon.releaseComponent(myComp);

Hope that helps,

Adam



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


Hi,

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:

myClass.enableLogging(loggerToUse);

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
Flowscript?

thanks!
Paul

=====
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message