Logging & Debugging von M(obile)AF Applikationen Jürgen Menge Sales Consultant Oracle Deutschland B.V. & Co. KG
Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle s products remains at the sole discretion of Oracle. Oracle Confidential Internal/Restricted/Highly Restricted 2
Agenda 1 2 3 4 Einstieg ins Thema Logging Debugging Weitere Informationen
Bestandteile einer Mobile Plattform Schutz der Unternehmensdaten Security Mobile Strategy MAINFRAME Entwicklung mobiler Applikationen Multiplatform Integration Zugriff auf Daten und Services
Oracle Mobile Application Framework Write Once, Deploy to Many Oracle MAF Basierende auf Standards Nutzung vorhandener Kenntnisse
Mobile Application Framework - Architektur Mobile Device Device Services MAF Device Native Container HTML 5, CSS3 & JavaScript Representation AMX Feature Components Controller Apache Cordova Plugins & APIs Local HTML Feature Java VM Client Logic JDBC SQLite App. Configuration Web View Remote URL Feature Encrypted Database Authentication, Credential Management & Access Control Server Configuration Service Server-Generated HTML REST or SOAP Services APN/GCM Push Services Oracle Confidential Internal/Restricted/Highly Restricted 6
Logging & Debugging von MAF-Applikationen ios Android Werkzeuge von Oracle MAF JDeveloper Remote Debugging JDeveloper Logging Plattformspezifische Werkzeuge Safari Web Inspector Android Monitor ddms chrome:/ /inspect Oracle Confidential Internal/Restricted/Highly Restricted 7
Agenda 1 2 3 4 Einstieg ins Thema Logging Debugging Weitere Informationen
Mobile Application Framework Java Logging System & Error Log (System.out.println, System.err.println) Embedded Logging(Default: com.sun.util.logging.logger) Konfiguration in der Datei../META-INF/logging.properties Logger.getLogger("oracle.adfmf.application").logp(Level.WARNING, this.getclass().getname(), "ontestmessage", "embedded warning message 3"); Oracle Confidential Internal/Restricted/Highly Restricted 9
Konfiguration des Logging - logging.properties Logger Default Settings 10
Mobile Application Framework JavaScript Logging Redirect des Output in Datei durch System.out <script type="text/javascript" charset="utf-8"> function test_function() { console.log("message from JavaScript");} </script> Verwendung einer Logging Methode im JavaScript adf.mf.log.application.logp(adf.mf.log.level.warning, "myclass", "mymethod", "My Message"); Oracle Confidential Internal/Restricted/Highly Restricted 11
ios Logging http://www.youtube.com/watch?v=uuqtbsmkmhu
Android Logging Output Log Datei Datei <AppName>.txt in /sdcard (vorletzte Version als *.txt.bak) Anzeige des Inhalts Lokaler Viewer auf dem Device/Emulator adb logcat (analog tail) Kopieren der Datei auf den Desktop Media Transfer Protocol (mtp) adb pull /sdcard/<file> <local_file>
Android Logging Monitor und ddms Debug Monitor (../android-sdk-linux/tools/monitor) Log Messages Filter, Suchfunktionalität File System Explorer Threads Heap usage Network stats Dalvik Debug Monitor Server (../android-sdk-linux/tools/ddms) deprecated
DEMONSTRATION Android Logging
Agenda 1 2 3 4 Einstieg ins Thema Logging Debugging Weitere Informationen
Mobile Application Framework Remote Debugging Breakpoints im Java Code setzen Debugging in der MAF-Applikation konfigurieren Gerät bzw. Simulator/Emulator vorbereiten Applikation im Debug Mode auf Gerät oder Simulator/Emulator deployen Applikation starten Debugger des JDeveloper mit der App verbinden
Debugging Breakpoints setzen Breakpoints in Java-Klassen setzen Lifecycle Methoden Managed Beans POJO Data Control keineevaluierung von EL-Ausdrücken keine Breakpoints in AMX-Dateien
Konfiguration des Debugging cvm.properties Konfiguration in der Datei../META-INF/cvm.properties Aktivieren des Debugging java.debug.enabled=true java.debug.port=8000 javascript.debug.enabled=true
Debugging Gerät bzw. Simulator/Emulator Android Emulator Android Virtual Device (AVD) anlegen und konfigurieren Android Device USB Debugging aktivieren (Developer Options) Installation von Apps aus unbekannten Quellen erlauben
Debugging Applikation deployen Deployment Profile auf Debug Mode setzen (Default) Application Properties Deployment => Deployment Profiles evtl. eigenes Profil für Debugging anlegen Gerät per USB verbinden Applikation deployen
Debugging Applikation starten und verbinden Applikation auf dem Gerät oder Simulator/Emulator starten Applikation wartet nach dem Start auf den Debug-Prozess Android Port Forwarding adb -d forward tcp:8000 tcp:8000 /Device adb -e forward tcp:8000 tcp:8000 /Emulator ios Simulator Eingehenden Netzwerk-Verbindung akzeptieren
Debugging Debugger starten Debugger im JDeveloper aufrufen Debugger mit der App verbinden
Debugging Applikation debuggen Debugger wartet am Breakpoint Step Through Step to the End Auswertung Breakpoints ADF Data Smart Data Data Watches Resume
DEMONSTRATION Android Debugging
Chrome Remote Debugging (1) Chrome Developer Tools ab Chrome 32 und Android 4.4 für WebView-Applikationen Datei cvm.properties javascript.debug.enabled=true Schritte Chrome aufrufen URL: chrome://inspect Discover USB Devices Port Forwarding? Liste der Pages
Chrome Remote Debugging (2) Elements: DOM Tree, HTML-Elemente, CSS, Event Listener, Viewport Sources: Debugging JavaScript Network: aufgerufene Dateien, Ladezeiten [F5] Audits: Analyse der Seiten beim Laden Console: Kommunikation mit der Anwendung ab 4.4.3 Screencast
Safari Remote Debugging (1) Datei cvm.properties javascript.debug.enabled=true Schritte Safari aufrufen Preferences => Advanced => Show Develop menu... Start der Applikation Liste der Pages
Safari Remote Debugging (2) Resources: DOM Tree, HTML-Elemente Styles: CSS Timelines: aufgerufene Dateien, Ladezeiten Console: Kommunikation mit der Anwendung
DEMONSTRATION Remote Debugging Chrome
Agenda 1 2 3 4 Einstieg ins Thema Logging Debugging Weitere Informationen
Weitere Informationen Dokumentation Mobile Application Framework 2.0.1 https://docs.oracle.com/middleware/mobile201/mobile/develop/maf-debug-test.htm#adfmf1044 Blogs Debugging ADF Mobile https://blogs.oracle.com/shay/entry/debugging_adf_mobile_apps_on https://blogs.oracle.com/mobile/entry/enable_javascript_debugging_on_mac http://java.dzone.com/articles/debugging-oracle-adf-mobile YouTube Videos Debugging ADF Mobile http://www.youtube.com/watch?v=uuqtbsmkmhu Chrome Developer Tools https://developer.chrome.com/devtools https://developer.chrome.com/devtools/docs/remote-debugging
Fragen & Antworten Jürgen Menge juergen.menge@oracle.com