It could be very handy to know how and where to read MAF logging output from iOS simulator. This is not that obvious to find logging output on Mac OS system. All log is written into application.log file, this file is located inside temporary application directory. I will explain how to locate this directory and how to open application.log file. You can read more about MAF testing and logging here - 18.5 Using and Configuring Logging.
Sample mobile application - ADFMobileLogginApp.zip, is pretty basic and contains System.out.println to write a message into application.log file:
Message is written to the log from Action Listener method, invoked from Save button. Log file application.log is accessible from the following location (you can access it from the console) -
Users/youruser/Library/Application Support/iPhone/ 7.1/Applications/com.company.ADFMobileLoggingApp/Document/logs.
As you can see, application.log file is stored under logs directory in documents folder. You must navigate to the iOS simulator, application temporary folder to access it:
There will be application.log file available:
Log file can be opened directly from console, execute command open -a TextEdit application.log:
Message from saveAction() is printed in the log:
Enjoy MAF coding in Mac OS !
Sample mobile application - ADFMobileLogginApp.zip, is pretty basic and contains System.out.println to write a message into application.log file:
Message is written to the log from Action Listener method, invoked from Save button. Log file application.log is accessible from the following location (you can access it from the console) -
Users/youruser/Library/Application Support/iPhone/ 7.1/Applications/com.company.ADFMobileLoggingApp/Document/logs.
As you can see, application.log file is stored under logs directory in documents folder. You must navigate to the iOS simulator, application temporary folder to access it:
There will be application.log file available:
Log file can be opened directly from console, execute command open -a TextEdit application.log:
Message from saveAction() is printed in the log:
Enjoy MAF coding in Mac OS !
Hi Andrejus. Great post. What you describe is necessary because the Log is redirected to a file.You can use Xcode to Prevent Redirecting the Log.
ReplyDeleteThat way you can view the log
statements in the console. This, however, is not default behavior. To achieve this you must use
Xcode. First you must open your Xcode project called Oracle_ADFmc_Container_Template.
xcodeproj. This project is created during deployment to the iOS Simulator and can be found in
your deployment directory.
When you double click this project, Xcode opens your app and you can inspect it. Next step
is to change the scheme settings for your application in Xcode so that log statements are no longer
redirected to a log file but displayed in the console real time.
In XCode, from the product menu | scheme | edit scheme and add the following argument to be passed
on launch
-consoleRedirect=FALSE
That should do the trick and the log statements are visible in the console.
Thanks
Luc
Thanks for the useful update.
ReplyDeleteAndrejus