You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@apache.org> on 2002/02/06 17:26:38 UTC

PrimordialLogger?

I have come to the conclusion that I need a PrimordialLogger for the ContainerManager system.
The PrimordialLogger is used until whatever LoggerManager is used sets up the system loggers.
This way I can have logging at all stages of the game, and avoid infinite loops when trying
to set up the LoggerManager.

The getLogger() method would be implemented in this fashion:

ContainerManager()
{
     m_primordialLogger = new PrimordialLogger();
}

Logger getLogger()
{
     if ( null != m_primordialLogger )
     {
         return m_primordialLogger;
     }

     return getLoggerManager().getDefaultLogger();
}

LoggerManager getLoggerManager()
{
     // do setup of LoggerManager
     m_primordialLogger = null;
     return m_loggerManager;
}


--------------------------------------------------------

The PrimordialLogger would be implemented like this:

public final class PrimordialLogger implements Logger
{
     public void debug( String message )
     {
         System.out.print("[DEBUG] ");
         System.out.println( message );
     }
     public void debug( String message, Throwable t )
     {
         debug( message );
         t.printStackTrace( System.out );
     }
     public boolean isDebugEnabled()
     {
         return true;
     }
}

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [Vote] Include ConsoleLogger in framework (was: RE: PrimordialLogger?)

Posted by Stephen McConnell <mc...@apache.org>.
Leo Sutic wrote:

*snip*

> I'm calling a vote:
> 
> Should the class org.apache.avalon.framework.logger.ConsoleLogger, as I
> implemented it, go into Avalon/Framework?
> 
> My argument for it:
> Sometimes it is impractical or impossible to obtain a logger. However, 
> in almost all cases the application has access to System.out. A 
> ConsoleLogger is a replacement for inserting System.out.println into 
> the code and brings higher code quality.
> 
> The ConsoleLogger belongs in framework. Framework consists of 
> interfaces and basic implementations of them. NullLogger and 
> ConsoleLogger gives us:
> 
>                 no logging: NullLogger
>  simplest possible logging: ConsoleLogger
>           (everything else: LogKit / Log4J / JDK1.4)
> 
> So we have the null object pattern in NullLogger, and the 
> simplest possible working implementation in ConsoleLogger.
> 
> END OF VOTE -------------------------------------------------------

+1 

with note that I think the default logging level should ERROR not DEBUG.






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[Vote] Include ConsoleLogger in framework (was: RE: PrimordialLogger?)

Posted by Leo Sutic <le...@inspireinfrastructure.com>.

> From: Berin Loritsch [mailto:bloritsch@apache.org]
>
> Leo Sutic wrote:
> > Berin,
> >
> > put it in framework.
> >
> > You may want to look at my ConsoleLogger class that I sent to
> the list about
> > an hour ago...
>
> Hmm.  I may use that and change it's name to PrimordialLogger ....

I'd prefer it stayed ConsoleLogger and that you just called the member
variable
m_primordialLogger. There's nothing primordial about the class - just
your use of it.

> Beyond those two logger implementations, I would not want any more direct
> implementations of the Logger interface in Framework.

I agree. I just wanted a quick'n'easy logger to complement NullLogger.

> I want to get some further feedback from others on the list
> before I decide to slip it in Framework.

The issues with the PrimordialLogger is a bit more complex,
so I'd just leave that for the moment and deal with the
inclusion of ConsoleLogger in framework first.

I'm calling a vote:

Should the class org.apache.avalon.framework.logger.ConsoleLogger, as I
implemented
it, go into Avalon/Framework?

My argument for it:
Sometimes it is impractical or impossible to obtain a logger. However, in
almost
all cases the application has access to System.out. A ConsoleLogger is a
replacement
for inserting System.out.println into the code and brings higher code
quality.

The ConsoleLogger belongs in framework. Framework consists of interfaces and
basic
implementations of them. NullLogger and ConsoleLogger gives us:

                no logging: NullLogger
 simplest possible logging: ConsoleLogger
          (everything else: LogKit / Log4J / JDK1.4)

So we have the null object pattern in NullLogger, and the simplest possible
working implementation in ConsoleLogger.

END OF VOTE -------------------------------------------------------

Regarding the PrimordialLogger: It seems fine, but I want an override so if
a ContainerManager is created by something that has a logger:

ContainerManager()
{
     this( new PrimordialLogger() );
}

ContainerManager(Logger primordialLogger)
{
     m_primordialLogger = primordialLogger;
}

This to be able to keep the application silent (maybe the app is used from
the shell
and reads from stdin, writes to stdout - you do not want to write stuff to
stdout
that you do not have complete control over).

/LS


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: PrimordialLogger?

Posted by Berin Loritsch <bl...@apache.org>.
Leo Sutic wrote:
> Berin,
> 
> put it in framework.
> 
> You may want to look at my ConsoleLogger class that I sent to the list about
> an hour ago...

Hmm.  I may use that and change it's name to PrimordialLogger ....

Beyond those two logger implementations, I would not want any more direct
implementations of the Logger interface in Framework.

:)

Thanks a heap, man!

I want to get some further feedback from others on the list before I decide
to slip it in Framework.


-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: PrimordialLogger?

Posted by Leo Sutic <le...@inspireinfrastructure.com>.
Berin,

put it in framework.

You may want to look at my ConsoleLogger class that I sent to the list about
an hour ago...

/LS

> -----Original Message-----
> From: Berin Loritsch [mailto:bloritsch@apache.org]
> Sent: den 6 februari 2002 17:29
> To: Avalon Developers List
> Subject: Re: PrimordialLogger?
>
>
> Berin Loritsch wrote:
>
> Oh, and one more question, should this go in Framework, or stay with the
> ContainerManager?
>
> > I have come to the conclusion that I need a PrimordialLogger for the
> > ContainerManager system.
> > The PrimordialLogger is used until whatever LoggerManager is used sets
> > up the system loggers.
> > This way I can have logging at all stages of the game, and avoid
> > infinite loops when trying
> > to set up the LoggerManager.
> >
> > The getLogger() method would be implemented in this fashion:
> >
> > ContainerManager()
> > {
> >     m_primordialLogger = new PrimordialLogger();
> > }
> >
> > Logger getLogger()
> > {
> >     if ( null != m_primordialLogger )
> >     {
> >         return m_primordialLogger;
> >     }
> >
> >     return getLoggerManager().getDefaultLogger();
> > }
> >
> > LoggerManager getLoggerManager()
> > {
> >     // do setup of LoggerManager
> >     m_primordialLogger = null;
> >     return m_loggerManager;
> > }
> >
> >
> > --------------------------------------------------------
> >
> > The PrimordialLogger would be implemented like this:
> >
> > public final class PrimordialLogger implements Logger
> > {
> >     public void debug( String message )
> >     {
> >         System.out.print("[DEBUG] ");
> >         System.out.println( message );
> >     }
> >     public void debug( String message, Throwable t )
> >     {
> >         debug( message );
> >         t.printStackTrace( System.out );
> >     }
> >     public boolean isDebugEnabled()
> >     {
> >         return true;
> >     }
> > }
> >
>
>
>
> --
>
> "They that give up essential liberty to obtain a little temporary safety
>   deserve neither liberty nor safety."
>                  - Benjamin Franklin
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: PrimordialLogger?

Posted by Berin Loritsch <bl...@apache.org>.
Berin Loritsch wrote:

Oh, and one more question, should this go in Framework, or stay with the
ContainerManager?

> I have come to the conclusion that I need a PrimordialLogger for the 
> ContainerManager system.
> The PrimordialLogger is used until whatever LoggerManager is used sets 
> up the system loggers.
> This way I can have logging at all stages of the game, and avoid 
> infinite loops when trying
> to set up the LoggerManager.
> 
> The getLogger() method would be implemented in this fashion:
> 
> ContainerManager()
> {
>     m_primordialLogger = new PrimordialLogger();
> }
> 
> Logger getLogger()
> {
>     if ( null != m_primordialLogger )
>     {
>         return m_primordialLogger;
>     }
> 
>     return getLoggerManager().getDefaultLogger();
> }
> 
> LoggerManager getLoggerManager()
> {
>     // do setup of LoggerManager
>     m_primordialLogger = null;
>     return m_loggerManager;
> }
> 
> 
> --------------------------------------------------------
> 
> The PrimordialLogger would be implemented like this:
> 
> public final class PrimordialLogger implements Logger
> {
>     public void debug( String message )
>     {
>         System.out.print("[DEBUG] ");
>         System.out.println( message );
>     }
>     public void debug( String message, Throwable t )
>     {
>         debug( message );
>         t.printStackTrace( System.out );
>     }
>     public boolean isDebugEnabled()
>     {
>         return true;
>     }
> }
> 



-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>