avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Tagunov <atagu...@mail.cnt.ru>
Subject Re[4]: [VOTE] ServletLogger.java into avalon-framework
Date Wed, 04 Jun 2003 13:27:59 GMT
Hello Peter!

PR> LogKit already as a ServletOutputTarget, why not just use that?

AT> The purpose is a bit different:
AT> * FortressConfig/ContextManager create a LoggerManager
AT>   from a config file on its own
AT> * but, to do this they need a "bootstrap" logger to report,
AT>   for instance, a missing or currepted logger manager config
AT>   file

PR> Perhaps Fortress can contain two predefined (ie known good) 
PR> LoggerManager configurations to use during that bootstrap process?

It's surely an option.
I was considering it when I before ever creating ServletLogger.

There were two reasons why I still have proposed a new class:


If we did this we would be unable to create a Fortress servlet
application with only Log4J.jar supplied and without any

Is it worth a new class?
Would you prefer to create one more class just to retain the
purity of concept and make logkit and log4j entirely
interexchangeable in Avalon?

I would :-)


The ConsoleLogger was so slim and the its simplicity was
so compelling that the I couldn't resist the temptation
to clone it.

ConsoleLogger is _very_ lightweight and very understandable.

Imagine we're setting up an example Servlet application running fortress
inside a servlet

* either as a demonstration of how Avalon rocks
  (I heard that someone was mention an Avalon Petstore ;-)

* or as a tutorial for new-bies

I beleive that

    Logger startupLogger = new ServletLogger( servletContext, ServletLogger.LEVEL_INFO );

will look far better then

    LogTarget servletTarget = new ServletOutputLogTarget( servletContext );
    Hierarchy hierarchy = new Hierarchy();
    hierarchy.setDefaultLogTarget( servletTarget );
    org.apache.log.Logger lkLogger = hierarchy.getRootLogger();
    lkLogger.setPriority( Priority.INFO );
    Logger startupLogger = new LogKitLogger( lkLogger );

And reading LogKitLoggerManager configuration from an input stream
(say ClassLoader.getResourceAsStream()) as it is in ContextManager
does not look much simplier. Those code has been frightening me
for a whole two weeks!

BTW LogKitLoggerManager itself needs a startup logger to log it's

In short, to get new-bies started with a servlet example we
will greatly benefit with a ServletLogger, they'll twice as
little classes to understand, and be 30% ;-) less frightened!


For that reason LogKit already has a StreamTarget, that can be rolled
over System.out or System.err, but we still use and love :-)
ConsoleLogger for the startup purposes, don't we?

WBR, Anton

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

View raw message