I had to add super(this) in a required constructor, but that seems to work,
thank you.
Thank you,
Jay Turner
-Original Message-
From: Scott Deboy [mailto:scott.de...@gmail.com]
Sent: Friday, July 15, 2011 11:12 PM
To: Log4J Users List
Subject: Re: I need to handle log4j:WARN
I want to be able to connect my new LoggerRepository to log4j before log4j runs
its default initialization. But log4j seems to initialize before any
significant code of mine is run. What causes the log4j initialization
(statics?, get* calls?)? What can I execute before log4j initialization is
To add to the issue:
I can use log4j.defaultInitOverride and then my application gets control first.
I can set log4j.configuratorClass and get control too. The issue is when my
code is deployed in environments that already have log4j implementations. They
may not set log4j.defaultInitOverride,
I call my Library Jar which has log4j setup in it. I'm calling a static method
in my class. Before I can get to the LogManager.setRepositorySelector, log4j
gets to run, loads its configuration from log4j.configuration, can't interpret
the unrecognized parameters, and generally finishes
Can try - When your app start make sure the first class that runs does
not have a log4j instance member or other reference to log4j besides
the repository call. Use system out till then.
On 7/19/11, Turner, Jay jay.tur...@sabre-holdings.com wrote:
I call my Library Jar which has log4j setup in
log4j initialization is running because of explicit programmatic
configuration (via PropertyConfigurator/DOMConfigurator) or more likely a
static logger declaration or a logger instance be initialized prior to your
configuration code being ran.
I'd suggest changing your logger declarations to be
The inherited code did have some public static final org.apache.log4j.Logger
... calls, thank you. Changing those allowed my code to be called first.
However a Catch-22 still exists. Trying:
private static final Object guard = new Object();
private static final LoggerRepositoryHandler
Can you lazily initialize the ref to the root logger in your
LoggerRepositoryHandler instead of passing it in to the constructor? It
seems like that should resolve your problem.
Scott
On Mon, Jul 18, 2011 at 3:02 PM, Turner, Jay
jay.tur...@sabre-holdings.comwrote:
The inherited code did have