Re: Log4J Ignores log4j.LogLevel
- From: Lew <lew@xxxxxxxxxxxxxxxx>
- Date: Wed, 25 Jul 2007 09:30:54 -0400
Mark Space wrote:
Lew wrote:
{private static Log _apacheLog = null;}if( null == _myLogger )
{
_myLogger = new Logger();
}
return _myLogger;
From this we see that _myLogger will change every time the factory method is invoked. Why do you store the value in the static member and return it, both?
Well, the _myLogger variable is private, so how else would it be accessed? Looks like a Singleton pattern to me. _myLogger shouldn't change with each invocation; it's only assigned when _myLogger is null to begin with, unless I'm missing something.
You are right, I missed that. Of course, log4j will always deliver the same Logger if you pass the same Class or String to the Logger factory anyway, so I'm questioning again why the need to provide a custom factory class.
The configuration of the Logger would be much easier to understand (for me, at least) if the Logger in question were log4j's. So I reiterate my suggestion that the OP use the log4j Logger class and its factory method.
--
Lew
.
- Follow-Ups:
- Re: Log4J Ignores log4j.LogLevel
- From: Kevin Sandal
- Re: Log4J Ignores log4j.LogLevel
- References:
- Log4J Ignores log4j.LogLevel
- From: Kevin Sandal
- Re: Log4J Ignores log4j.LogLevel
- From: Lew
- Re: Log4J Ignores log4j.LogLevel
- From: Mark Space
- Log4J Ignores log4j.LogLevel
- Prev by Date: Re: Question for Roedy
- Next by Date: Re: non blocking write on TCP/IP channel
- Previous by thread: Re: Log4J Ignores log4j.LogLevel
- Next by thread: Re: Log4J Ignores log4j.LogLevel
- Index(es):
Relevant Pages
|
|