So… I like what I see here, and am considering replacing what I've built for some apps we have, to compare&contrast. However before I start digging in, I wanted to see whether you (and the group) thought my use case was worthwhile. Here's what I have in my existing application:
- Log4J-style loggers, via defines, across each class I use a "logger" for.
- A plist-style configuration file in the application which defines a global "level", plus any number of key/value pairs for class/level (allows per classname detail).
- Log to a file while on-device, with a set range the file size can be, currently simplified as a "low-water" max, and a "high-water" max of 2x the low-water one. When the high-water max is crossed, it's truncated back to the low-water threshold.
- On application minimize, we write a separate "Clean Exit" file. On resume/startup, if we don't detect said file, we auto-send the current log file to us (devs).
This seems to be working well for us, but has some limitations (I'm using lower-level functions, mmap (PROT_READ, MAP_SHARED), fseek, etc for speed) but I'm not certain that iOS will inform me if/when my usage crosses a watchdog (or other) boundary that it deems inappropriate (and thus shoots my app). We don't use the app store (enterprise MDM instead) so we don't see any OOM style crashes, and I am still getting the occasional "no clean exit" send of data from our apps to us, hence my interest in trying a drop-in replacement of Lumberjack for some targeted users of ours, to see if things improve.
In order for this to work for us, I'd need a few things, which I'm not sure Lumberjack would support. I'm happy to code up subclasses and configure as necessary, but don't want to stretch the architecture if it won't fit. I'd need:
- Synchronized, immediate write to a single log. I may move to asynchronous/queued writes, but we rely on our loggers getting the "last log written" right before a crash sometimes
- All logs still logged in release builds, obviously
- Some form of log-truncation, if possible. Otherwise I'll have to use the log rotation and merge in files (which may not be hard, IIUC).
- #define'd switching between what we have and Lumberjack usage (this seems dead easy, really).
So that's it, thanks for listening, and comments very welcome. Very nice code there, from what I've seen so far!
./scc