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 Lars Schouw <sc...@yahoo.com> on 2004/05/20 09:14:57 UTC

You have tried to set a null level to root.

I tried to add a configuration file to my project but
when I run it I get this error:
You have tried to set a null level to root.
and an exception it thrown.
This is before I even hit the main function so it must
belong to the static variable I declared the is
initialized when the object is loaded.

My souce code:

// include log4cxx header files.
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/helpers/exception.h>

using namespace log4cxx;
using namespace log4cxx::helpers;

// Define a static logger variable so that it
references the logger instance named "RALtest".
LoggerPtr logger = Logger::getLogger(_T("RALtest"));

int main(int argc, char* argv[])
{
	int result = EXIT_SUCCESS;
	try
	{
		if (argc > 1)
        {
			USES_CONVERSION;
			String propertyFileName = argv[1];
			PropertyConfigurator::configure(propertyFileName);
		 }
		else
        {
			BasicConfigurator::configure();
        }

		logger->info(_T("Entering RALtest application."));
....

Lars







	
		
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer 

Minor bug in the documentation

Posted by Lars Schouw <sc...@yahoo.com>.
There are missing two % on the web page.

http://logging.apache.org/log4cxx/manual/Introduction.html

 

log4j.appender.stdout.layout.ConversionPattern=%5p [t] (F:L) - m%n

should be 

log4j.appender.stdout.layout.ConversionPattern=%5p [t] (F:L) - %m%n

 

and

log4j.appender.R.layout.ConversionPattern=%p t c - m%n
should be 

log4j.appender.R.layout.ConversionPattern=%p t c - %m%n


 

 

log4j.rootLogger=debug, stdout, R




log4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayout




# Pattern to output the caller's file name and line number.log4j.appender.stdout.layout.ConversionPattern=%5p [t] (F:L) - m%n




log4j.appender.R=org.apache.log4j.RollingFileAppenderlog4j.appender.R.File=example.log




log4j.appender.R.MaxFileSize=100KB




# Keep one backup filelog4j.appender.R.MaxBackupIndex=1




log4j.appender.R.layout=org.apache.log4j.PatternLayoutlog4j.appender.R.layout.ConversionPattern=%p t c - m%n



		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Re: libsmtp

Posted by Lars Schouw <sc...@yahoo.com>.
Salue Micha�l
I found a weblog that explains how to do it in C++.
http://www.vbbox.com/blog/2004/05/remember-cdosys-and-some-c-code.html
 
Lars

Michael CATANZARITI <mc...@free.fr> wrote:
Hello Lars,

libsmtp is not available for Windows.

Under Windows, I intented to implement the SMTPAppender with the library CDO
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/exchanchor/htms/msexchsvr_cdowin2000.asp

But I didn't find the time.

Micha�l

Selon Lars Schouw :

> I can't find anyone for Windows.
> Any ideas?
> Lars
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger


		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Re: libsmtp

Posted by Michael CATANZARITI <mc...@free.fr>.
Hello Lars,

libsmtp is not available for Windows.

Under Windows, I intented to implement the SMTPAppender with the library CDO
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/exchanchor/htms/msexchsvr_cdowin2000.asp

But I didn't find the time.

Michaël

Selon Lars Schouw <sc...@yahoo.com>:

> I can't find anyone for Windows.
> Any ideas?
> Lars
> 
> 		
> ---------------------------------
> Do you Yahoo!?
> Friends.  Fun. Try the all-new Yahoo! Messenger



libsmtp

Posted by Lars Schouw <sc...@yahoo.com>.
I can't find anyone for Windows.
Any ideas?
Lars

		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

Re: libsmtp.h is missing

Posted by Lars Schouw <sc...@yahoo.com>.
Found out I need to download libsmtp as well.
http://freshmeat.net/projects/libsmtp/
 
Lars
 

		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

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

Posted by Michaël CATANZARITI <mc...@free.fr>.
log4cxx tests (built with cppunit) are passed successfully under linux,  
and Windows (VC6 and VC7) before each version release.

Michaël

Lars Schouw wrote:

> Would be nice to have cppunit up and running as well.
> This will make testring much easier in the future.
> Version 1.9.14 works under Visual C++ 7.1 / Visual Studio 2003 as well.
> Lars
>  
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger 
> <http://messenger.yahoo.com/> 



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

Posted by Lars Schouw <sc...@yahoo.com>.
Would be nice to have cppunit up and running as well.
This will make testring much easier in the future.
Version 1.9.14 works under Visual C++ 7.1 / Visual Studio 2003 as well.
Lars
 

		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

libsmtp.h missing

Posted by Lars Schouw <sc...@yahoo.com>.
I tried to define HAVE_SMTP while building.

It tells me that the file libsmtp.h missing is missing while building smtpappender.cpp.

I had a quick look in CVS but could not find it there.

Any ideas? 

I have version 0.9.7

Lars


		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

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

Posted by Michaël CATANZARITI <mc...@free.fr>.
Lars,

I am wondering if I should not review the whole initialization of 
log4cxx for similar problems occur under MacOSX and HPUX.

Michaël

Lars Schouw wrote:

> Michaël
>  
> It works now. ;) Will this go into CVS?
>  
> Lars
>
> */Michaël_CATANZARITI <mc...@free.fr>/* wrote:
>
>     Hello,
>
>     It seems the problem is related to the construction order of static
>     variables.
>
>     Visual C++ 7.1, constructs static variables in the declaration
>     order for
>     each source file, and in the link order of each obj file and
>     library for
>     a whole module.
>     So, the static variable used in the delayedloop example is
>     constructed
>     before the static variables declared in log4cxxs.lib (for the linker
>     parse delayedloop.obj first).
>     Accordingly, the static variables concerning levels, implemented in
>     level.cpp are initialized later. This is was the rootLogger level
>     seems
>     not to be set.
>
>     Please add the following lines on top of the files level.cpp and
>     logmanager.cpp :
>
>     // Force initialization early.
>     #pragma warning(disable: 4074)
>     #pragma warning(disable: 4073)
>     #pragma init_seg(lib)
>
>
>
>     The directive '#pragma init_seg(lib)' permits to force the static
>     variables implemented in its scope to be initialized first.
>
>     Michaël
>
>     Lennart Goedhart wrote:
>
>     >Yeah, I have the same problem if I try to use the static log4cxx
>     library.
>     >It's dumping at the point it's trying to assign the static
>     Bar::logger.
>     >It works fine if you use the log4cxx.lib (therefore the dll).
>     >As to why this is the case, that's a question for one of the log4cxx
>     >developers, I guess.
>     >
>     >----- Original Message -----
>     >From: "Lars Schouw"
>     >To: "Log4CXX User"
>     >Sent: Thursday, May 20, 2004 7:32 PM
>     >Subject: Re: You have tried to set a null level to root.
>     >
>     >
>     >
>     >
>     >>Lennart
>     >>
>     >>You are really a great help thank for always answering
>     >>so quick!
>     >>
>     >>It dumps before that it even gets to there!
>     >>
>     >>I took out the A2W here A2W(argv[1]); as well since
>     >>since my code is not unicode.
>     >>
>     >>I pass the following into the program as a startup
>     >>argument. config/LogSettings.txt
>     >>
>     >>Well I have this configuration file called
>     >>LogSettings.txt
>     >>
>     >># Set root logger level to DEBUG and its only appender
>     >>to A1.
>     >>log4j.rootLogger=DEBUG, A1
>     >>
>     >># A1 is set to be a ConsoleAppender.
>     >>log4j.appender.A1=org.apache.log4j.ConsoleAppender
>     >>
>     >># A1 uses PatternLayout.
>     >>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>     >>log4j.appender.A1.layout.ConversionPattern=%d [%t]
>     >>%-5p %c %x - %m (F:L)%n
>     >>
>     >>Also in the meanwhile I tried to setup the trivial
>     >>project replacing the code with the bar sample you
>     >>have in the documentation.
>     >>When I run it I get an error like before
>     >>You have tried to set a null level to root.
>     >>and in this case it runs down the sample code until
>     >>this line is called:
>     >>logger->info(_T("Entering application."));
>     >>where an exception is thrown.
>     >>In the console I get this.
>     >>First-chance exception at 0x77e73887 in trivial.exe:
>     >>Microsoft C++ exception:
>     >>log4cxx::helpers::RuntimeException @ 0x0012fddc.
>     >>Please be awair the the code is not the trivial.cpp
>     >>from your sample but the code from the documentation.
>     >>
>     >>Again I am using the static library I compiled myself.
>     >>
>     >>Also one more thing when I build I get some warnings.
>     >>They come from an error in the documentation;
>     >>#include ;
>     >>Should be without the last semicolon.
>     >>
>     >>
>     >>
>     >>
>     >>Regards
>     >>Lars Schouw
>     >>
>     >>--- Lennart Goedhart wrote:
>     >>
>     >>
>     >>>I assume you get this when you pass the arg of the
>     >>>config file. What does your config file look like?
>     >>>When I comile that snippet of your code (with a few
>     >>>minor changes), it works fine.
>     >>>I have he logfile I pass working with Conole,
>     >>>RollingFile and ODBC appenders...
>     >>> ----- Original Message -----
>     >>> From: Lars Schouw
>     >>> To: Log4CXX User
>     >>> Sent: Thursday, May 20, 2004 5:23 PM
>     >>> Subject: Re: You have tried to set a null level to
>     >>>root.
>     >>>
>     >>>
>     >>> Sorry forgot to tell that I also have a static
>     >>>variable declared in a header file
>     >>> static log4cxx::LoggerPtr logger;
>     >>>
>     >>>
>     >>>
>     >>> Lars Schouw wrote:
>     >>> I tried to add a configuration file to my
>     >>>project but
>     >>> when I run it I get this error:
>     >>> You have tried to set a null level to root.
>     >>> and an exception it thrown.
>     >>> This is before I even hit the main function so
>     >>>it must
>     >>> belong to the static variable I declared the is
>     >>> initialized when the object is loaded.
>     >>>
>     >>> My souce code:
>     >>>
>     >>> // include log4cxx header files.
>     >>> #include
>     >>> #include
>     >>> #include
>     >>> #include
>     >>>
>     >>> using namespace log4cxx;
>     >>> using namespace log4cxx::helpers;
>     >>>
>     >>> // Define a static logger variable so that it
>     >>> references the logger instance named "RALtest".
>     >>> LoggerPtr logger =
>     >>>Logger::getLogger(_T("RALtest"));
>     >>>
>     >>> int main(int argc, char* argv[])
>     >>> {
>     >>> int result = EXIT_SUCCESS;
>     >>> try
>     >>> {
>     >>> if (argc > 1)
>     >>> {
>     >>> USES_CONVERSION;
>     >>> String propertyFileName = argv[1];
>     >>>
>     >>>PropertyConfigurator::configure(propertyFileName);
>     >>> }
>     >>> else
>     >>> {
>     >>> BasicConfigurator::configure();
>     >>> }
>     >>>
>     >>> logger->info(_T("Entering RALtest
>     >>>application."));
>     >>> ....
>     >>>
>     >>> Lars
>     >>>
>     >>>
>     >>>
>     >>>
>     >>>
>     >>>
>     >>>
>     >>>
>     >>>
>     >>> __________________________________
>     >>> Do you Yahoo!?
>     >>> Yahoo! Domains - Claim yours for only
>     >>>$14.70/year
>     >>> http://smallbusiness.promotions.yahoo.com/offer
>     >>>
>     >>>
>     >>>
>     >>>
>     >>>
>     >>--------------------------------------------------------------------------
>     >>
>     >>
>     >----
>     >
>     >
>     >>> Do you Yahoo!?
>     >>> Yahoo! Domains - Claim yours for only $14.70/year
>     >>>
>     >>>
>     >>
>     >>
>     >>
>     >>__________________________________
>     >>Do you Yahoo!?
>     >>Yahoo! Domains - Claim yours for only $14.70/year
>     >>http://smallbusiness.promotions.yahoo.com/offer
>     >>
>     >>
>     >
>     >
>     >
>     >
>     >
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger 
> <http://messenger.yahoo.com/> 



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

Posted by Lars Schouw <sc...@yahoo.com>.
Micha�l
 
It works now. ;) Will this go into CVS?
 
Lars

Micha�l_CATANZARITI <mc...@free.fr> wrote:
Hello,

It seems the problem is related to the construction order of static 
variables.

Visual C++ 7.1, constructs static variables in the declaration order for 
each source file, and in the link order of each obj file and library for 
a whole module.
So, the static variable used in the delayedloop example is constructed 
before the static variables declared in log4cxxs.lib (for the linker 
parse delayedloop.obj first).
Accordingly, the static variables concerning levels, implemented in 
level.cpp are initialized later. This is was the rootLogger level seems 
not to be set.

Please add the following lines on top of the files level.cpp and 
logmanager.cpp :

// Force initialization early.
#pragma warning(disable: 4074)
#pragma warning(disable: 4073)
#pragma init_seg(lib)



The directive '#pragma init_seg(lib)' permits to force the static variables implemented in its scope to be initialized first.

Micha�l

Lennart Goedhart wrote:

>Yeah, I have the same problem if I try to use the static log4cxx library.
>It's dumping at the point it's trying to assign the static Bar::logger.
>It works fine if you use the log4cxx.lib (therefore the dll).
>As to why this is the case, that's a question for one of the log4cxx
>developers, I guess.
>
>----- Original Message ----- 
>From: "Lars Schouw" 
>To: "Log4CXX User" 
>Sent: Thursday, May 20, 2004 7:32 PM
>Subject: Re: You have tried to set a null level to root.
>
>
> 
>
>>Lennart
>>
>>You are really a great help thank for always answering
>>so quick!
>>
>>It dumps before that it even gets to there!
>>
>>I took out the A2W here A2W(argv[1]); as well since
>>since my code is not unicode.
>>
>>I pass the following into the program as a startup
>>argument. config/LogSettings.txt
>>
>>Well I have this configuration file called
>>LogSettings.txt
>>
>># Set root logger level to DEBUG and its only appender
>>to A1.
>>log4j.rootLogger=DEBUG, A1
>>
>># A1 is set to be a ConsoleAppender.
>>log4j.appender.A1=org.apache.log4j.ConsoleAppender
>>
>># A1 uses PatternLayout.
>>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>>log4j.appender.A1.layout.ConversionPattern=%d [%t]
>>%-5p %c %x - %m (F:L)%n
>>
>>Also in the meanwhile I tried to setup the trivial
>>project replacing the code with the bar sample you
>>have in the documentation.
>>When I run it I get an error like before
>>You have tried to set a null level to root.
>>and in this case it runs down the sample code until
>>this line is called:
>>logger->info(_T("Entering application."));
>>where an exception is thrown.
>>In the console I get this.
>>First-chance exception at 0x77e73887 in trivial.exe:
>>Microsoft C++ exception:
>>log4cxx::helpers::RuntimeException @ 0x0012fddc.
>>Please be awair the the code is not the trivial.cpp
>>from your sample but the code from the documentation.
>>
>>Again I am using the static library I compiled myself.
>>
>>Also one more thing when I build I get some warnings.
>>They come from an error in the documentation;
>>#include ;
>>Should be without the last semicolon.
>>
>>
>>
>>
>>Regards
>>Lars Schouw
>>
>>--- Lennart Goedhart wrote:
>> 
>>
>>>I assume you get this when you pass the arg of the
>>>config file. What does your config file look like?
>>>When I comile that snippet of your code (with a few
>>>minor changes), it works fine.
>>>I have he logfile I pass working with Conole,
>>>RollingFile and ODBC appenders...
>>> ----- Original Message ----- 
>>> From: Lars Schouw
>>> To: Log4CXX User
>>> Sent: Thursday, May 20, 2004 5:23 PM
>>> Subject: Re: You have tried to set a null level to
>>>root.
>>>
>>>
>>> Sorry forgot to tell that I also have a static
>>>variable declared in a header file
>>> static log4cxx::LoggerPtr logger;
>>>
>>>
>>>
>>> Lars Schouw wrote:
>>> I tried to add a configuration file to my
>>>project but
>>> when I run it I get this error:
>>> You have tried to set a null level to root.
>>> and an exception it thrown.
>>> This is before I even hit the main function so
>>>it must
>>> belong to the static variable I declared the is
>>> initialized when the object is loaded.
>>>
>>> My souce code:
>>>
>>> // include log4cxx header files.
>>> #include
>>> #include
>>> #include
>>> #include
>>>
>>> using namespace log4cxx;
>>> using namespace log4cxx::helpers;
>>>
>>> // Define a static logger variable so that it
>>> references the logger instance named "RALtest".
>>> LoggerPtr logger =
>>>Logger::getLogger(_T("RALtest"));
>>>
>>> int main(int argc, char* argv[])
>>> {
>>> int result = EXIT_SUCCESS;
>>> try
>>> {
>>> if (argc > 1)
>>> {
>>> USES_CONVERSION;
>>> String propertyFileName = argv[1];
>>>
>>>PropertyConfigurator::configure(propertyFileName);
>>> }
>>> else
>>> {
>>> BasicConfigurator::configure();
>>> }
>>>
>>> logger->info(_T("Entering RALtest
>>>application."));
>>> ....
>>>
>>> Lars
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> __________________________________
>>> Do you Yahoo!?
>>> Yahoo! Domains - Claim yours for only
>>>$14.70/year
>>> http://smallbusiness.promotions.yahoo.com/offer
>>>
>>>
>>>
>>> 
>>>
>>--------------------------------------------------------------------------
>> 
>>
>----
> 
>
>>> Do you Yahoo!?
>>> Yahoo! Domains - Claim yours for only $14.70/year
>>> 
>>>
>>
>>
>>
>>__________________________________
>>Do you Yahoo!?
>>Yahoo! Domains - Claim yours for only $14.70/year
>>http://smallbusiness.promotions.yahoo.com/offer
>> 
>>
>
>
>
> 
>

		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

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

Posted by Michaël CATANZARITI <mc...@free.fr>.
Hello,

It seems the problem is related to the construction order of static 
variables.

Visual C++ 7.1, constructs static variables in the declaration order for 
each source file, and in the link order of each obj file and library for 
a whole module.
So, the static variable used in the delayedloop example is constructed 
before the static variables declared in log4cxxs.lib (for the linker 
parse delayedloop.obj first).
Accordingly, the static variables concerning levels, implemented in 
level.cpp are initialized later. This is was the rootLogger level seems 
not to be set.

Please add the following lines on top of the files level.cpp and 
logmanager.cpp :

// Force initialization early.
#pragma warning(disable: 4074)
#pragma warning(disable: 4073)
#pragma init_seg(lib)



The directive '#pragma init_seg(lib)' permits to force the static variables implemented in its scope to be initialized first.

Michaël

Lennart Goedhart wrote:

>Yeah, I have the same problem if I try to use the static log4cxx library.
>It's dumping at the point it's trying to assign the static Bar::logger.
>It works fine if you use the log4cxx.lib (therefore the dll).
>As to why this is the case, that's a question for one of the log4cxx
>developers, I guess.
>
>----- Original Message ----- 
>From: "Lars Schouw" <sc...@yahoo.com>
>To: "Log4CXX User" <lo...@logging.apache.org>
>Sent: Thursday, May 20, 2004 7:32 PM
>Subject: Re: You have tried to set a null level to root.
>
>
>  
>
>>Lennart
>>
>>You are really a great help thank for always answering
>>so quick!
>>
>>It dumps before that it even gets to there!
>>
>>I took out the A2W here A2W(argv[1]); as well since
>>since my code is not unicode.
>>
>>I pass the following into the program as a startup
>>argument. config/LogSettings.txt
>>
>>Well I have this configuration file called
>>LogSettings.txt
>>
>># Set root logger level to DEBUG and its only appender
>>to A1.
>>log4j.rootLogger=DEBUG, A1
>>
>># A1 is set to be a ConsoleAppender.
>>log4j.appender.A1=org.apache.log4j.ConsoleAppender
>>
>># A1 uses PatternLayout.
>>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>>log4j.appender.A1.layout.ConversionPattern=%d [%t]
>>%-5p %c %x - %m (F:L)%n
>>
>>Also in the meanwhile I tried to setup the trivial
>>project replacing the code with the bar sample you
>>have in the documentation.
>>When I run it I get an error like before
>>You have tried to set a null level to root.
>>and in this case it runs down the sample code until
>>this line is called:
>>logger->info(_T("Entering application."));
>>where an exception is thrown.
>>In the console I get this.
>>First-chance exception at 0x77e73887 in trivial.exe:
>>Microsoft C++ exception:
>>log4cxx::helpers::RuntimeException @ 0x0012fddc.
>>Please be awair the the code is not the trivial.cpp
>>from your sample but the code from the documentation.
>>
>>Again I am using the static library I compiled myself.
>>
>>Also one more thing when I build I get some warnings.
>>They come from an error in the documentation;
>>#include <log4cxx/logger.h>;
>>Should be without the last semicolon.
>>
>>
>>
>>
>>Regards
>>Lars Schouw
>>
>>--- Lennart Goedhart <le...@omnibase.com.au> wrote:
>>    
>>
>>>I assume you get this when you pass the arg of the
>>>config file. What does your config file look like?
>>>When I comile that snippet of your code (with a few
>>>minor changes), it works fine.
>>>I have he logfile I pass working with Conole,
>>>RollingFile and ODBC appenders...
>>>  ----- Original Message ----- 
>>>  From: Lars Schouw
>>>  To: Log4CXX User
>>>  Sent: Thursday, May 20, 2004 5:23 PM
>>>  Subject: Re: You have tried to set a null level to
>>>root.
>>>
>>>
>>>  Sorry forgot to tell that I also have a static
>>>variable declared in a header file
>>>  static log4cxx::LoggerPtr logger;
>>>
>>>
>>>
>>>  Lars Schouw <sc...@yahoo.com> wrote:
>>>    I tried to add a configuration file to my
>>>project but
>>>    when I run it I get this error:
>>>    You have tried to set a null level to root.
>>>    and an exception it thrown.
>>>    This is before I even hit the main function so
>>>it must
>>>    belong to the static variable I declared the is
>>>    initialized when the object is loaded.
>>>
>>>    My souce code:
>>>
>>>    // include log4cxx header files.
>>>    #include
>>>    #include
>>>    #include
>>>    #include
>>>
>>>    using namespace log4cxx;
>>>    using namespace log4cxx::helpers;
>>>
>>>    // Define a static logger variable so that it
>>>    references the logger instance named "RALtest".
>>>    LoggerPtr logger =
>>>Logger::getLogger(_T("RALtest"));
>>>
>>>    int main(int argc, char* argv[])
>>>    {
>>>    int result = EXIT_SUCCESS;
>>>    try
>>>    {
>>>    if (argc > 1)
>>>    {
>>>    USES_CONVERSION;
>>>    String propertyFileName = argv[1];
>>>
>>>PropertyConfigurator::configure(propertyFileName);
>>>    }
>>>    else
>>>    {
>>>    BasicConfigurator::configure();
>>>    }
>>>
>>>    logger->info(_T("Entering RALtest
>>>application."));
>>>    ....
>>>
>>>    Lars
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>    __________________________________
>>>    Do you Yahoo!?
>>>    Yahoo! Domains - Claim yours for only
>>>$14.70/year
>>>    http://smallbusiness.promotions.yahoo.com/offer
>>>
>>>
>>>
>>>      
>>>
>>--------------------------------------------------------------------------
>>    
>>
>----
>  
>
>>>  Do you Yahoo!?
>>>  Yahoo! Domains - Claim yours for only $14.70/year
>>>      
>>>
>>
>>
>>
>>__________________________________
>>Do you Yahoo!?
>>Yahoo! Domains - Claim yours for only $14.70/year
>>http://smallbusiness.promotions.yahoo.com/offer
>>    
>>
>
>
>
>  
>


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

Posted by Lennart Goedhart <le...@omnibase.com.au>.
Yeah, I have the same problem if I try to use the static log4cxx library.
It's dumping at the point it's trying to assign the static Bar::logger.
It works fine if you use the log4cxx.lib (therefore the dll).
As to why this is the case, that's a question for one of the log4cxx
developers, I guess.

----- Original Message ----- 
From: "Lars Schouw" <sc...@yahoo.com>
To: "Log4CXX User" <lo...@logging.apache.org>
Sent: Thursday, May 20, 2004 7:32 PM
Subject: Re: You have tried to set a null level to root.


> Lennart
>
> You are really a great help thank for always answering
> so quick!
>
> It dumps before that it even gets to there!
>
> I took out the A2W here A2W(argv[1]); as well since
> since my code is not unicode.
>
> I pass the following into the program as a startup
> argument. config/LogSettings.txt
>
> Well I have this configuration file called
> LogSettings.txt
>
> # Set root logger level to DEBUG and its only appender
> to A1.
> log4j.rootLogger=DEBUG, A1
>
> # A1 is set to be a ConsoleAppender.
> log4j.appender.A1=org.apache.log4j.ConsoleAppender
>
> # A1 uses PatternLayout.
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern=%d [%t]
> %-5p %c %x - %m (F:L)%n
>
> Also in the meanwhile I tried to setup the trivial
> project replacing the code with the bar sample you
> have in the documentation.
> When I run it I get an error like before
> You have tried to set a null level to root.
> and in this case it runs down the sample code until
> this line is called:
> logger->info(_T("Entering application."));
> where an exception is thrown.
> In the console I get this.
> First-chance exception at 0x77e73887 in trivial.exe:
> Microsoft C++ exception:
> log4cxx::helpers::RuntimeException @ 0x0012fddc.
> Please be awair the the code is not the trivial.cpp
> from your sample but the code from the documentation.
>
> Again I am using the static library I compiled myself.
>
> Also one more thing when I build I get some warnings.
> They come from an error in the documentation;
> #include <log4cxx/logger.h>;
> Should be without the last semicolon.
>
>
>
>
> Regards
> Lars Schouw
>
> --- Lennart Goedhart <le...@omnibase.com.au> wrote:
> > I assume you get this when you pass the arg of the
> > config file. What does your config file look like?
> > When I comile that snippet of your code (with a few
> > minor changes), it works fine.
> > I have he logfile I pass working with Conole,
> > RollingFile and ODBC appenders...
> >   ----- Original Message ----- 
> >   From: Lars Schouw
> >   To: Log4CXX User
> >   Sent: Thursday, May 20, 2004 5:23 PM
> >   Subject: Re: You have tried to set a null level to
> > root.
> >
> >
> >   Sorry forgot to tell that I also have a static
> > variable declared in a header file
> >   static log4cxx::LoggerPtr logger;
> >
> >
> >
> >   Lars Schouw <sc...@yahoo.com> wrote:
> >     I tried to add a configuration file to my
> > project but
> >     when I run it I get this error:
> >     You have tried to set a null level to root.
> >     and an exception it thrown.
> >     This is before I even hit the main function so
> > it must
> >     belong to the static variable I declared the is
> >     initialized when the object is loaded.
> >
> >     My souce code:
> >
> >     // include log4cxx header files.
> >     #include
> >     #include
> >     #include
> >     #include
> >
> >     using namespace log4cxx;
> >     using namespace log4cxx::helpers;
> >
> >     // Define a static logger variable so that it
> >     references the logger instance named "RALtest".
> >     LoggerPtr logger =
> > Logger::getLogger(_T("RALtest"));
> >
> >     int main(int argc, char* argv[])
> >     {
> >     int result = EXIT_SUCCESS;
> >     try
> >     {
> >     if (argc > 1)
> >     {
> >     USES_CONVERSION;
> >     String propertyFileName = argv[1];
> >
> > PropertyConfigurator::configure(propertyFileName);
> >     }
> >     else
> >     {
> >     BasicConfigurator::configure();
> >     }
> >
> >     logger->info(_T("Entering RALtest
> > application."));
> >     ....
> >
> >     Lars
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >     __________________________________
> >     Do you Yahoo!?
> >     Yahoo! Domains - Claim yours for only
> > $14.70/year
> >     http://smallbusiness.promotions.yahoo.com/offer
> >
> >
> >
> --------------------------------------------------------------------------
----
> >   Do you Yahoo!?
> >   Yahoo! Domains - Claim yours for only $14.70/year
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains - Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer


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

Posted by Lars Schouw <sc...@yahoo.com>.
Lennart

You are really a great help thank for always answering
so quick!

It dumps before that it even gets to there!

I took out the A2W here A2W(argv[1]); as well since
since my code is not unicode.

I pass the following into the program as a startup
argument. config/LogSettings.txt

Well I have this configuration file called
LogSettings.txt

# Set root logger level to DEBUG and its only appender
to A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t]
%-5p %c %x - %m (F:L)%n

Also in the meanwhile I tried to setup the trivial
project replacing the code with the bar sample you
have in the documentation.
When I run it I get an error like before
You have tried to set a null level to root.
and in this case it runs down the sample code until
this line is called:
logger->info(_T("Entering application."));
where an exception is thrown.
In the console I get this.
First-chance exception at 0x77e73887 in trivial.exe:
Microsoft C++ exception:
log4cxx::helpers::RuntimeException @ 0x0012fddc.
Please be awair the the code is not the trivial.cpp
from your sample but the code from the documentation.

Again I am using the static library I compiled myself.

Also one more thing when I build I get some warnings.
They come from an error in the documentation;
#include <log4cxx/logger.h>;
Should be without the last semicolon.




Regards
Lars Schouw

--- Lennart Goedhart <le...@omnibase.com.au> wrote:
> I assume you get this when you pass the arg of the
> config file. What does your config file look like?
> When I comile that snippet of your code (with a few
> minor changes), it works fine.
> I have he logfile I pass working with Conole,
> RollingFile and ODBC appenders...
>   ----- Original Message ----- 
>   From: Lars Schouw 
>   To: Log4CXX User 
>   Sent: Thursday, May 20, 2004 5:23 PM
>   Subject: Re: You have tried to set a null level to
> root.
> 
> 
>   Sorry forgot to tell that I also have a static
> variable declared in a header file
>   static log4cxx::LoggerPtr logger;
> 
> 
> 
>   Lars Schouw <sc...@yahoo.com> wrote:
>     I tried to add a configuration file to my
> project but
>     when I run it I get this error:
>     You have tried to set a null level to root.
>     and an exception it thrown.
>     This is before I even hit the main function so
> it must
>     belong to the static variable I declared the is
>     initialized when the object is loaded.
> 
>     My souce code:
> 
>     // include log4cxx header files.
>     #include 
>     #include 
>     #include 
>     #include 
> 
>     using namespace log4cxx;
>     using namespace log4cxx::helpers;
> 
>     // Define a static logger variable so that it
>     references the logger instance named "RALtest".
>     LoggerPtr logger =
> Logger::getLogger(_T("RALtest"));
> 
>     int main(int argc, char* argv[])
>     {
>     int result = EXIT_SUCCESS;
>     try
>     {
>     if (argc > 1)
>     {
>     USES_CONVERSION;
>     String propertyFileName = argv[1];
>    
> PropertyConfigurator::configure(propertyFileName);
>     }
>     else
>     {
>     BasicConfigurator::configure();
>     }
> 
>     logger->info(_T("Entering RALtest
> application."));
>     ....
> 
>     Lars
> 
> 
> 
> 
> 
> 
> 
> 
> 
>     __________________________________
>     Do you Yahoo!?
>     Yahoo! Domains - Claim yours for only
> $14.70/year
>     http://smallbusiness.promotions.yahoo.com/offer 
> 
> 
>
------------------------------------------------------------------------------
>   Do you Yahoo!?
>   Yahoo! Domains - Claim yours for only $14.70/year



	
		
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer 

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

Posted by Lennart Goedhart <le...@omnibase.com.au>.
I assume you get this when you pass the arg of the config file. What does your config file look like?
When I comile that snippet of your code (with a few minor changes), it works fine.
I have he logfile I pass working with Conole, RollingFile and ODBC appenders...
  ----- Original Message ----- 
  From: Lars Schouw 
  To: Log4CXX User 
  Sent: Thursday, May 20, 2004 5:23 PM
  Subject: Re: You have tried to set a null level to root.


  Sorry forgot to tell that I also have a static variable declared in a header file
  static log4cxx::LoggerPtr logger;



  Lars Schouw <sc...@yahoo.com> wrote:
    I tried to add a configuration file to my project but
    when I run it I get this error:
    You have tried to set a null level to root.
    and an exception it thrown.
    This is before I even hit the main function so it must
    belong to the static variable I declared the is
    initialized when the object is loaded.

    My souce code:

    // include log4cxx header files.
    #include 
    #include 
    #include 
    #include 

    using namespace log4cxx;
    using namespace log4cxx::helpers;

    // Define a static logger variable so that it
    references the logger instance named "RALtest".
    LoggerPtr logger = Logger::getLogger(_T("RALtest"));

    int main(int argc, char* argv[])
    {
    int result = EXIT_SUCCESS;
    try
    {
    if (argc > 1)
    {
    USES_CONVERSION;
    String propertyFileName = argv[1];
    PropertyConfigurator::configure(propertyFileName);
    }
    else
    {
    BasicConfigurator::configure();
    }

    logger->info(_T("Entering RALtest application."));
    ....

    Lars









    __________________________________
    Do you Yahoo!?
    Yahoo! Domains - Claim yours for only $14.70/year
    http://smallbusiness.promotions.yahoo.com/offer 


------------------------------------------------------------------------------
  Do you Yahoo!?
  Yahoo! Domains - Claim yours for only $14.70/year

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

Posted by Lars Schouw <sc...@yahoo.com>.
Sorry forgot to tell that I also have a static variable declared in a header file

static log4cxx::LoggerPtr logger;


Lars Schouw <sc...@yahoo.com> wrote:
I tried to add a configuration file to my project but
when I run it I get this error:
You have tried to set a null level to root.
and an exception it thrown.
This is before I even hit the main function so it must
belong to the static variable I declared the is
initialized when the object is loaded.

My souce code:

// include log4cxx header files.
#include 
#include 
#include 
#include 

using namespace log4cxx;
using namespace log4cxx::helpers;

// Define a static logger variable so that it
references the logger instance named "RALtest".
LoggerPtr logger = Logger::getLogger(_T("RALtest"));

int main(int argc, char* argv[])
{
int result = EXIT_SUCCESS;
try
{
if (argc > 1)
{
USES_CONVERSION;
String propertyFileName = argv[1];
PropertyConfigurator::configure(propertyFileName);
}
else
{
BasicConfigurator::configure();
}

logger->info(_T("Entering RALtest application."));
....

Lars









__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer 
		
---------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year