In the summary of CocoaLumberjack it is mentioned that "Lumberjack is Powerful", and then "Want more? Create your own loggers (it's easy) and send your log statements over the network." So, I wonder how can we send log statements over the network through CocoaLumberjack? Is there an existing interface to do this? Or must we do it by our own code? Could somebody give me sample code to this?
Asked
Active
Viewed 2,897 times
6
-
I found an awesome library that does the file upload over network in background. https://github.com/pushd/BackgroundUpload-CocoaLumberjack – Suresh Varma Oct 13 '15 at 10:38
1 Answers
5
To answer your question, there isn't anything built-in for sending logs over the network.
You can take the highroad and:
- obtain the logs by creating a new logger (see how this guy created a new logger that redirects the logs to Crashlytics: https://github.com/TechSmith/CrashlyticsLumberjack)
OR
- read the logs from a file logger and sending those over the network. Use the DDFileLogger logFileManager to get the sortedLogFilePaths (list of paths to the log files). Those files are plain text and can be read like any other file.

Bogdan
- 101
- 2
-
Do you know of any good strategy for sending the log files over the network? For example, you obviously don't want to be doing it to often, but what might be a good interval or event to trigger a log upload? – ebi Feb 04 '15 at 06:54
-
1@ebi I would recommend taking a look at the Demos workspace that comes with CocoaLumberjack, especially the CoreDataLogger project. They present some ideas on handling batching and update frequency/intervals for trigging log uploads that I think would also apply to a network logger. – Michael McGuire Feb 04 '15 at 17:26
-
@ebi You might use a similar approach with analytics frameworks like Google Analytics. They send over batches of information after app start or app return from background or before the app is closed. – Bogdan Feb 09 '15 at 20:22
-
Thanks, I will probably use the Core Data logger in combination with some of the app lifecycle events. – ebi Feb 09 '15 at 20:50