logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Butcher <p...@paulbutcher.com>
Subject Re: Status of stream.h?
Date Mon, 06 Jun 2005 21:00:36 GMT
Thanks for the various responses on this topic.

On Monday 06 June 2005 19:57, Curt Arnold wrote:
> It has been stalled for quite some time, however Christopher Smith
> has expressed interest in restarting it.  The semantics shouldn't
> change much but ...

I haven't looked into it in great detail, so can't suggest a solution, but I 
suspect that it will need a change to the semantics to be useful. At the 
moment, very simple constructs like:

  log4cxx::logstream ls(logger, Level::DEBUG);
  std::string s = "Test";
  ls << s;

fail (with a very long template-related error message which I won't reproduce 
here).

It seems to work with simple types (char*, int, etc) but not with anything 
more complex :-(

> log4j's CVS HEAD has a parameterized log methods that could mimicked
> in log4cxx, but I haven't mocked anything out.  The new log4j methods
> are something like:
>
> logger.info("Hello, {}.", "World");
>
> It isn't the most general approach, but it does cover a huge amount
> of common use cases.

Thanks - but am I right in thinking that this isn't available in log4cxx just 
yet?

What I've been doing for the time being is this kind of thing:

  std::ostringstream message;
  message << ... ;
  LOG4CXX_DEBUG(logger, message.str());

or, if efficiency matters:

  if(logger->isDebugEnabled())
  {
    std::ostringstream message;
    message << ... ;
    LOG4CXX_DEBUG(logger, message.str());
  }

Is this the best option with the package as it currently stands? Or is there a 
better alternative?

Thanks!

paul.butcher->msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

Mime
View raw message