Here's a snippet to do that. Since you mentioned you
don't know log4j well enough, note the use of
PropertyConfigurator in the snippet: this reads the
log4j properties file. (There are other ways to
configure log4j, but if you get this working and study
the docs you'll save some time.)
#snippet:
PropertyConfigurator.configure(propertiesFile);
org.apache.log4j.Logger logImpl =
org.apache.log4j.Logger.getLogger("myRootLogger");
org.apache.avalon.framework.logger.Logger logger = new
org.apache.avalon.framework.logger.Log4JLogger(logImpl);
// enable logging of your root svc mgr or whatever
// you need to do with your root logger
enableLogging(logger);
Ruben
On Thu, 05 Feb 2004 22:25:26 +0100, Stephen McConnell
wrote:
>
> Florian I. Hayd wrote:
> > Hi there,
> >
> > I'm new to the Avalon framework and trying to figure
> out a few things, I don't
> > understand right now.
> > I'm trying to use Log4J as the standard logging
> engine for my project based on
> > merlin. There seem to be posibilities to use Log4J
as
> standard logging. Is this
> > the right assumption?
>
> Not yet.
>
> Under Merlin 3.3 HEAD a new logging system has been
put
> in place that
> allows plug replaceable logging solutions. Currently
> the default and
> only implementation is based on LogKit - however, the
> new framework
> allows for now logging solutions without modification
> of the merlin core
> system.
>
> > Can anybody tell me, how to accomplish that or did I
> > understand something wrong.
>
> You can accomplish this by writing a factory that
> produces a Log4J based
> implementation of the LoggingManager interface. The
> code in the
> avalon/logging directory should provide a good
> reference of how things work.
>
> > I tried to write my own AbstractLogEnabled version
> and in that using the Log4J
> > as logger. But then I dont't know how to configure
> Log4J correctly. Trying to
> > have a external possibility to set the logging
> properties would leave me with
> > configuring it during the configuration stage of my
> component. But this would
> > mean, I can't log before that. Also the merlin
output
> seem to use the standard
> > logging mechanism.
>
> This will not work. Its the LoggingManager's
> responsibility to
> establish logging targets and supply logging channels
> on demand.
>
> > Am I missing something? Is there an easy way to do
it?
> > Is there maybe a page which tells me how to use the
> logging and how to set it
> > up?
>
> Docs on all of this are not in place yet - but take a
> look at the code -
> its basically two packages - the api (which defines
the
> LoggingManager)
> and the current LogKit impl.
>
> Cheers, Stephen.
>
> > Thanks
> >
> > Florian Hayd
> >
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
>
>
> --
>
> |------------------------------------------------|
> | Magic by Merlin |
> | Production by Avalon |
> | |
> | http://avalon.apache.org/merlin |
> | http://dpml.net/merlin/distributions/latest |
> |------------------------------------------------|
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
-------------------------------
http://www.rubenkleiman.com
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]