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::Debug(const char *msg)
{
if(CLogger::oLogger != NULL)
{
LOG4CXX_DEBUG(CLogger::oLogger,"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::oLogger != NULL) which is always returning oLogger as NULL.
Can anyone offer any help on this.