rm5248 commented on PR #170:
URL: https://github.com/apache/logging-log4cxx/pull/170#issuecomment-1364026238

   The reason I didn't make separate macros is that I don't want to change log 
statements if I now want a stack trace.  The intention is that you simply 
`#define LOG4CXX_ENABLE_STACKTRACE` at the top of your file, so that within 
that file you will get stacktraces as part of your log statements(this is 
similar to the Linux kernel `DEBUG` macro, where if it is not defined debug log 
statements will be compiled out).  The stack traces are not very useful if 
you're not building a debug build anyway, because you won't get the method 
names.
   
   So in my mind there are a few ways we could do this:
   
   1. Keep as-is, but add new macros that unconditionally add in the stacktraces
   2. Add in a new macro that prints out a stack trace(something like 
`LOG4CXX_STACKTRACE(logger)`)
   3. Create some new macros that determine what level(s) the stacktrace is 
inserted into the MDC at(similar to the `LOG4CXX_THRESHOLD` macro)
   4. Ignore this entirely and simply document some examples of how you might 
use Boost stacktrace to generate a stacktrace
   
   Originally I had it so that the stacktrace was generated by internal log4cxx 
code, but the problem with that is that by the time you create the stacktrace 
you're already 10-12 layers in, so the stacktrace is not very useful - it 
really needs to start at the log statement.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to