X

The Mobile & Digital Assistant Blog covers the latest in mobile and conversational AI development and engagement

How to manage iOS log files in MAF 2.1

Guest Author

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:

/Users/mvakoc/Library/Developer/CoreSimulator

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:

/Users/mvakoc/Library/Developer/CoreSimulator/Devices/00DEC99D-0651-43A7-9AC8-319680B85C10

The file structure isolates applications and their data into various containers.  Containers are a way to separate an application’s private resources (the application itself) from a location that may be shared with others (e.g. a directory shared between an application and an extension it bundles with it) and the data containers.  The application, when installed, will get put in the Bundle container location, something like

/Users/mvakoc/Library/Developer/CoreSimulator/Devices/00DEC99D-0651-43A7-9AC8-319680B85C10/data/Containers/Bundle/Application/66D7BCF4-BDF2-4334-85AE-21DD7E3636C3/Oracle_ADFmc_Container_Template.app

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:

 /Users/mvakoc/Library/Developer/CoreSimulator/Devices/00DEC99D-0651-43A7-9AC8-319680B85C10/data/Containers/Data/Application/21BAF3C1-4244-4383-8584-9713B6979A01

The actual log file will be contained in the documents directory contained inside, like:

/Users/mvakoc/Library/Developer/CoreSimulator/Devices/00DEC99D-0651-43A7-9AC8-319680B85C10/data/Containers/Data/Application/21BAF3C1-4244-4383-8584-9713B6979A01/Documents/logs/application.log

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.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.

Recent Content