I've been using LumberJack and enjoying it over traditional logging macros. One thing that has been tripping me up, however, is that when I break in the debugger, some times logs will still be in the queue and I won't see their output. Is there any way to force the logging to occur synchronously (as NSLog does), so that everything has printed to console right at the moment that line is executed?
Yes, this is possible. The easiest way, if you want to do it temporarily, is just to toggle this in DDLog.h :
#define LOG_ASYNC_ENABLED YES
Just change it to NO, and asynchronous logging is disabled. You'll see how it gets uses in the header file.
There's also a comment block right above that section in the header file which you may want to check out. It basically encourages you to create your own MyLogging.h file so that you can customize stuff (such as asynchronous logging) to better suite your requirements. This means you won't need to make any changes to the open source files, meaning it will be easy to pull in updates, improvements and bug fixes in the future.
On Friday, July 13, 2012 at 1:51 PM, rich wrote:
> I've been using LumberJack and enjoying it over traditional logging macros. One thing that has been tripping me up, however, is that when I break in the debugger, some times logs will still be in the queue and I won't see their output. Is there any way to force the logging to occur synchronously (as NSLog does), so that everything has printed to console right at the moment that line is executed?
> Thanks
> -- > You received this message because you are subscribed to the Google Groups "CocoaLumberjack" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/cocoalumberjack/-/2q87iegIGyMJ.
> To post to this group, send email to cocoalumberjack@googlegroups.com (mailto:cocoalumberjack@googlegroups.com).
> To unsubscribe from this group, send email to cocoalumberjack+unsubscribe@googlegroups.com (mailto:cocoalumberjack+unsubscribe@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/cocoalumberjack?hl=en.
I agree with you that I should learn how to create my own logging config, but that'll have to wait until there is more time. Based on your 'easiest way' advice, I added the following after I #import DDLog.h:
#if defined( LOG_ASYNC_ENABLED ) #undef LOG_ASYNC_ENABLED #define LOG_ASYNC_ENABLED NO #endif
This way, I don't have to edit your framework and I can prolong getting into the nitty gritty. :) I also only do this for debug, so errors / warnings logged in release builds are still async.
Thanks again for such a flexible logging tool, I feel I'll be using it for some time.
On Wednesday, July 18, 2012 5:38:46 PM UTC-4, Robbie Hanson wrote:
> Yes, this is possible. The easiest way, if you want to do it temporarily, > is just to toggle this in DDLog.h :
> #define LOG_ASYNC_ENABLED YES
> Just change it to NO, and asynchronous logging is disabled. You'll see how > it gets uses in the header file.
> There's also a comment block right above that section in the header file > which you may want to check out. It basically encourages you to create your > own MyLogging.h file so that you can customize stuff (such as asynchronous > logging) to better suite your requirements. This means you won't need to > make any changes to the open source files, meaning it will be easy to pull > in updates, improvements and bug fixes in the future.
> -Robbie Hanson
> On Friday, July 13, 2012 at 1:51 PM, rich wrote:
> I've been using LumberJack and enjoying it over traditional logging > macros. One thing that has been tripping me up, however, is that when I > break in the debugger, some times logs will still be in the queue and I > won't see their output. Is there any way to force the logging to > occur synchronously (as NSLog does), so that everything has printed to > console right at the moment that line is executed?
> Thanks
> -- > You received this message because you are subscribed to the Google Groups > "CocoaLumberjack" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/cocoalumberjack/-/2q87iegIGyMJ. > To post to this group, send email to cocoalumberjack@googlegroups.com. > To unsubscribe from this group, send email to > cocoalumberjack+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/cocoalumberjack?hl=en.