Kyle R. Burton on Mon, 16 Jun 2003 12:04:05 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] C++ Development


> Hey... I looked around a bit, and found this. I'm not exactly sure how
> mature or decent a port it is, but maybe it'd be enough. On the surface
> it looks exactly like what you're talking about. 
> 
> 
> http://log4cxx.sourceforge.net/

The fact that they have "Development Status: Beta" in red right
on the main page makes me less than confident about using it.

One thing that the Jakarta projects seem to have going for them is
the fact that they have a large community of users.

The Jakarat Log4j download page:

  http://jakarta.apache.org/log4j/docs/download.html

Also lists 2 alternative ports to C++:

  http://log4cplus.sourceforge.net/
  http://log4cpp.sourceforge.net/

log4cplus reports that the first 'production' release should be out
by the 26h of July.  I suppose log4cpp looks like it could be a viable 
candidate for logging support.

In the Java code it's easy to tie logging context to the class
that is reqesting the logger:

  public class Foo {
    Logger logger = Logger.getInstance( Foo.class.getName() );
  }

In Perl it's just about the same (and can be easier with static
methods that query caller()):

  our $logger = Logger::getInstance(__PACKAGE__);
  # or, even easier:
  our $logger = Logger::getInstance;

  # then to wrap it...
  package Logger;
  sub getInstance
  {
    my($context) = @_;
    $context ||= (caller)[0];
    return Log::Log4perl->get_logger($context);
  }

How could this be done in C++?  Is there a preprocessor define for
the current object?  I know about __FILE__, __LINE__ and __FUNCTION__.
Is there some equivalent for the namesapce and/or the class name?


Thanks for the reply,

Kyle

-- 

------------------------------------------------------------------------------
Wisdom and Compassion are inseparable.
        -- Christmas Humphreys
mortis@voicenet.com                            http://www.voicenet.com/~mortis
------------------------------------------------------------------------------
_________________________________________________________________________
Philadelphia Linux Users Group        --       http://www.phillylinux.org
Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug