Great. That is what I needed. Thanks a lot.


----- Original Message ----
From: Curt Arnold <[EMAIL PROTECTED]>
To: Log4CXX User <log4cxx-user@logging.apache.org>
Sent: Friday, September 12, 2008 2:23:46 PM
Subject: Re: Forward Declaration


On Sep 12, 2008, at 12:00 PM, Jon Dahl wrote:

> Hello,
>
> I'm wondering if it is possible to use forward declaration with  
> log4cxx classes in a class header file. I would like to exclude the  
> log4cxx headers files in my header files if possible and include the  
> log4cxx header files in my cpp(source) files.
>
> Should this work?
>

No.  LoggerPtr is a template expansion and you'd need at least the  
template definition incorporate it in a header file.  However, you may  
want to consider not having a LoggerPtr in your class definition at  
all, but just have it in your implementation.  Something like:

myfoo.cpp

#include <log4cxx/logger.h>

//  anonymous namespace, members are visible only in this compilation  
unit
//   like static but better
//
namespace {
log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger());
}

void Foo::someFunction() {
     LOG4CXX_INFO(logger, "Hello, World");
}


      

Reply via email to