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" <[EMAIL PROTECTED]> To: "Log4CXX User" <[email protected]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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
