You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Ulf Renman <ul...@vocab.se> on 2004/12/06 17:01:46 UTC

Error: You have tried to set a null level to root

Hi Mike

Could you be a little more elaborate aboute the solution please. I think
I have the exact problem you describe here but I do not understand how to
solve it. Im using log4cxx-0.9.7 under linux with g++ 3.2.3. I've built two
modules as shared libraries who I want to use from my main program. But I
get the same error as described below so..

Are the reordering of linking supposed to be done when I build log4cxx and
if so how do I do that (I'm not a autoconf and make master)?

Thanks

/Ulf

-----Original Message-----
From: Bristol, Michael <mi...@brooks.com>
Subject: Error: You have tried to set a null level to root
Date: Wed, 1 Sep 2004 16:57:38 -0400
Content-Type: text/plain;
	charset="iso-8859-1"

Regarding the "null level to root" issue - I found it to be a symptom of the
order of initialization of objects in the library.  I believe it has been
discussed before - the log4cxx-user mailing list archives have some mention
of it under the context of static library problems.

I poked around in a debugger when I was getting it and found that sometimes
the static members on the Level class that define the logging levels (i.e.
Level::OFF, Level::DEBUG, etc) can be requested by the application before
the module that they reside in has been initialized.  So instead of a
pointer to a new Level Object, asking for Level:OFF just gives you null and
that causes the error.

If I re-ordered the link line so that level.o and logmamager.o came first
and it went away.  Additionally if you've got something calling log4cxx
during pre-main initialization in a shared library environment, make sure
the log4cxx library comes first in the link line.

I have not found a good answer to the "single configuration file" question
yet myself.  Maybe it's intended to be left up to the user of log4cxx to
configure.

Later,
   Mike

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.806 / Virus Database: 548 - Release Date: 2004-12-05


Re: Error: You have tried to set a null level to root

Posted by Curt Arnold <ca...@houston.rr.com>.
On Dec 6, 2004, at 10:01 AM, Ulf Renman wrote:

> Hi Mike
>
> Could you be a little more elaborate aboute the solution please. I 
> think
> I have the exact problem you describe here but I do not understand how 
> to
> solve it. Im using log4cxx-0.9.7 under linux with g++ 3.2.3. I've 
> built two
> modules as shared libraries who I want to use from my main program. 
> But I
> get the same error as described below so..
>
> Are the reordering of linking supposed to be done when I build log4cxx 
> and
> if so how do I do that (I'm not a autoconf and make master)?
>
> Thanks
>

There is not a reliable way to work around the problem.  It has been 
fixed in the CVS.  Unfortunately, JIRA (http://nagoya.apache.org/JIRA) 
and the mailing list archives are down at the moment, so I can't point 
out the specific date of the changes.  The JIRA bug is fairly low, 
something LOGCXX-7 or so and mentions "Initialization failing on 
multiple platforms".

In the migration to APR, we've been introducing some significant 
changes and have one big one left before 0.9.8.  If you are just 
wanting to get something working right now with the least hassle, you 
might pull a CVS snapshot immediately after that fix.  If you are 
courageous, you can pull the current CVS snapshot which adds a 
dependency to Apache Portable Runtime.