By Denis T on Feb 04, 2015
Where do I typically find the MAF log file?
MAF logs to a file named application.log. On both the simulator this file is created in the application’s documents directory under a subdirectory named “logs”. Locating the actual log file for an application, particularly since iOS 8 and Xcode 6, is a bit tricky. To find the file we have to understand the file system of the iOS simulator (and underlying iOS).
The iOS simulator stores all it’s content in the CoreSimulator directory located in a path like:
The simulator can have any number of devices and each device is uniquely identified by a UUID, so the contents of an actual device will be under a subdirectory with that UUID, like:
The data container is the location for the documents (user files), library (caches, preferences), and temporary files for a given application. An iCloud enabled application can have multiple data containers in a given application. MAF doesn’t use this so there will only be one data container containing the Documents location. It will again be stored under a UDID in the sandbox area, like:
The actual log file will be contained in the documents directory contained inside, like:
In short, it is very difficult to an outside observer (outside the application itself) to locate these resources.
On a device you have much less insight into the directory structure. If the application has been installed to the device using a developer provisioning profile you can use the Xcode devices window to view and download the installed applications container, which will contain the log file
If you are using an App Store or distribution installed application it will be very difficult to obtain the log from the device. You really need to add the ability to get the log file from the application itself (e.g. use email to send the log file.)
What a pain. Can I put the log file somewhere easier to get?
Yes. When running on the iOS simulator you can use the -consoleRedirect=/path/to/log/file.txt to send the log file to a more desirable and easier to find location. You can specify these options directly in Xcode (if you are launching from the Xcode project) or directly in the Run/Debug configuration in JDeveloper.
There are some limitations to this approach. You must launch the application with this argument. Directly launching the application already installed on a device will cause it to launch without this argument so the contents will go back to the regular location. Use the JDeveloper run configuration (the green triangle) to launch and run the app and this should make life easier.