Working with Log4CXX
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Working with Log4CXX

  1. #1
    Join Date
    Jun 2010
    Posts
    50

    Question 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 02:51 AM.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,295

    Re: Working with Log4CXX

    Shouldn't you compare oLogger to null instead of CLogger::Logger?

  3. #3
    Join Date
    Jun 2010
    Posts
    50

    Re: Working with Log4CXX

    Quote Originally Posted by Arjay View Post
    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center