Re: [D] Next Log4cxx Major release thoughts [logging-log4c xx]

rm5248 (via GitHub) <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.devel
Message-ID <ghd-D_kwDOBToI6s4AhRe1-92854603-6500-45c5-8c67-9d5e1821b9d4__19478.933040385$1759261644$gmane$org@gitbox.apache.org>
GitHub user rm5248 added a comment to the discussion: Next Log4cxx Major release thoughts

> > Remove APR(or at the very minimum make it optional). I would like to see the core library be in just standard C++
> 
> I do not believe it is yet possible to remove the APR dependency as it provides essential functionality (e.g. apr_file_write, apr_proc_create) that is not yet in the C++ standard library.
> 

Is there a reason that we should continue to use the APR functions?  I haven't looked closely, but I think for the most part the APR functions are wrappers around `fopen` and other C functions.

> > Are there certain operations that could be better handled by newer C++ features? For example, could we make the API more usable by removing the LOG4CXX_DEBUG family of macros and instead use variadic templates?
> 
> I suggest changing the LOG4CXX_DEBUG family of macros to require logged values be copy-constructible/move-constructible. This would allow us to implement the equivalent to "asynchronous loggers" that is already in Log4j2, and for users to see performance benefits without any code change. The LoggingEvent would need to hold a `std::vector<std::function<void(MessageBuffer&)>>` or similar.

I like that thought.

I haven't messed around with it yet, but if we want to support newer C++ standards, we could automatically create `std::backtrace` objects, and use `std::source_location` instead of the custom type that exists today.  The problem with the backtrace is that I don't have any ideas on how to make it easy without a macro at the moment.  The only thing I can think of is to do a fluent interface like:

```
logger.debug("message").withLocation().withBacktrace();
```

But I prefer having the macros, since that can expand into code better.  The above example is similar to what [flogger](https://github.com/google/flogger) does.


GitHub link: https://github.com/apache/logging-log4cxx/discussions/519#discussioncomment-14556357

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.