2

I am developing a Beta iOS (7 and 8) app which will be handed to testers soon.

I would like to have a send feedback button which will send the developers a human description of what went wrong, along with the recent log files.

enter image description here

Since writing log files can consume a lot of space, I would like to rotate the files based on their size, like the Linux logrotate utility. That is, write the first N log lines to a app.log, then rename app.log to app.log.1, delete the old app.log.1 and continue writing to a new app.log.

This way I will have at most 2N log lines in the iOS filesystem, and on my error reports.

Is there an open-source, production-ready tool for file log rotation on iOS?

Adam Matan
  • 128,757
  • 147
  • 397
  • 562

1 Answers1

2

I have used https://github.com/CocoaLumberjack/CocoaLumberjack it's fast, flexible and very easy to setup and use.

VishJ
  • 238
  • 2
  • 3
  • 9
  • Thanks! Does it support file rotating based on size? – Adam Matan Oct 05 '14 at 08:38
  • Of course check out their API - DDFileLogger class has APIs like - setMaximumFileSize, setRollingFrequency, setMaximumNumberOfLogFiles which gives you great flexibility. – VishJ Oct 05 '14 at 08:56
  • I found [this](https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Documentation/LogFileManagement.md), but I am looking for something more specific. – Adam Matan Oct 05 '14 at 09:00
  • What specific thing you were looking for ? https://github.com/CocoaLumberjack/CocoaLumberjack/blob/master/Documentation/GettingStarted.md – VishJ Oct 05 '14 at 17:41
  • There's time based log rotation, but no size based rotation at that page. – Adam Matan Oct 06 '14 at 03:13
  • http://cocoadocs.org/docsets/CocoaLumberjack/2.0.0-beta/Classes/DDFileLogger.html#//api/name/maximumFileSize – VishJ Oct 06 '14 at 18:02