-
November 18th, 2013, 02:58 AM
#1
Object inside class becomes NULL
I have built LOG4CXX lib and DLL and trying to use it in my application
Loh.h
class Log
{
public:
Log(void);
~Log(void);
void Debug(const char *msg);
private:
static LoggerPtr oLogger;
};
Log.cpp
LoggerPtr oLogger = NULL;
Log::Log()
{
LoggerPtr oLogger(Logger::getLogger("Test"));
PropertyConfigurator::configure("Logger4CXX.properties");
}
void CLogger:ebug(const char *msg)
{
if(CLogger:Logger != NULL)
{
LOG4CXX_DEBUG(CLogger:Logger,"Testing application...");
}
}
In my main I am initializing Log class object and calling Debug method to log debug message to a file.
Issue I am facing is at if(CLogger:Logger != NULL) which is always returning oLogger as NULL.
Can anyone offer any help on this.
Last edited by forstudy3; November 18th, 2013 at 03:51 AM.
-
November 18th, 2013, 03:52 AM
#2
Re: Working with Log4CXX
Shouldn't you compare oLogger to null instead of CLogger::Logger?
-
November 18th, 2013, 04:31 AM
#3
Re: Working with Log4CXX
Originally Posted by Arjay
Shouldn't you compare oLogger to null instead of CLogger::Logger?
Yes did that changes , it was a silly mistake ,sorry.
Still My issue not solved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|