The LogManager is the class from where you must
retrieve instances of Logger. This class internally
holds a reference to a RespositorySelector instance. A
RepositorySelector is responsable to select the
LoggerRepository for a particular application context.

A LoggerRepository is used to create and retrieve
Loggers. The relationship between loggers in a
repository depends on the repository but typically
loggers are arranged in a named hierarchy.

By default the class used as repository selector is
the Hierarchy class (wich implements the
LoggerRepository interface) whose root logger is
initialized in the static initializer of the
LogManager class with a reference to an instance of
RootCategory (The constructor of Hierarchy receives
the root logger instance as parameter). 

I think that one way to change the root logger will be
to initialize the RepositorySelector of the LogManager
class with a new Hierarchy built with your Root Logger
as parameter. This should be done before initilizing
Log4J, because when you change the RepositorySelector
you will loose all the configuration you might have
done.

Anyway, I think the development team is working on a
easier way to change the implementation of the Logger
implementation but this is not available on the
versiong 1.2 of Log4J.

For more information about this read the task labeled
'Multiple Implementations of Logger' on:

http://jakarta.apache.org/log4j/docs/plan.html


--- Simon Rosin <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I am working on integrating log4j into a project, we
> have created new
> Level and Logger classes (inheriting from the log4j
> Level and Logger
> classes) but would also like to override the
> getRootLogger, to return an
> instance of our class, not a log4j.Logger object.
> 
> How do you go about placing your own rootlogger in
> place of the log4j
> object created in the repository? Can you do it
> without rebuilding the
> log4j jar - this is what I'd really like to do, but
> I can't see a way of
> doing this...
> 
> Cheers,
> Simon
> 
> 
> ********** CAUTION - Disclaimer **********
> This message may contain privileged and confidential
> information. If you are not the intended recipient
> of this
> message (or responsible for delivery of the message
> to
> such person) you are hereby notified that any use,
> dissemination, distribution or reproduction of this
> message
> is prohibited. If you have received this message in
> error,
> you should destroy it and kindly notify the sender
> by reply
> e-mail. Please advise immediately if you or your
> employer
> do not consent to Internet e-mail for messages of
> this kind.
> Opinions, conclusions and other information in this
> message that do not relate to the official business
> of
> Expert Information Services Pty Ltd ("The Company")
> shall be understood as neither given nor endorsed by
> it.
> 
> The Company advises that this e-mail and any
> attached
> files should be scanned to detect viruses. The
> Company
> accepts no liability for loss or damage (whether
> caused
> by negligence or not) resulting from the use of any
> attached files.
> **EIS******** End of Disclaimer **********
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:log4j-dev-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:log4j-dev-help@;jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@;jakarta.apache.org>

Reply via email to