SlideShare a Scribd company logo
1 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Real World ADF Design & Architecture Principles
Error and Information Logging
ORACLE
PRODUCT
LOGO
15th Feb 2013 v1.0
3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Learning Objectives
•  At the end of this module you should be able to:
–  Understand logging in Oracle ADF
–  Know when to log and when to log
–  Know how to read and analyze ADF logs
Image: imagerymajestic/ FreeDigitalPhotos.net
4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Program Agenda
•  Why instrument?
•  Logging design
•  Logging and the developer
5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Why Instrument Your Applications?
•  It’s a great debugging aid for development
–  But that is not the primary goal
•  The dirty truth about end users:
–  Use the application not your code –
• They can’t explain what they are doing in a way
that relates to what you’re looking at
–  Don’t remember what they did to cause the error
• “I didn’t do anything”
–  They lie
6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Instrumentation Goals
•  Help the intelligent site admin self diagnose
–  Good logging should not assume that the reader has the source
code
•  Help your support organization make an educated guess
–  Log messages are great search terms
•  Help developers focus on the likely cause
–  “How on earth is that parameter null….?”
–  “What did you do before you didn’t do anything?”
7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.7 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Wouldn't it be best to log everything that happens
within an application to leave fine traces of what
happens in case things go wrong?
Image: imagerymajestic/ FreeDigitalPhotos.net
8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Program Agenda
•  Why instrument?
•  Logging design
•  Logging and the developer
9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Why use the ADF Logger?
•  System.out.println is not a logger!
–  Cannot be switched off, filtered or easily captured
•  Many Java logging implementations exist but you should use the
ADF Logger
–  It’s part of the framework, no extra libraries, no classloader issues
–  Fully integrated with both JDeveloper and Enterprise Manager
–  Integrates with FMW-wide logging infrastructure (ECID)
–  Switchable at runtime
–  Uses java.util.Logging under the covers
10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
What’s ECID?
•  Execution Context ID
–  Unique ID for a particular transaction (e.g. Web Request)
•  64 bit identifier + Sequence
–  Allows you to
follow the trail
of events in that
transaction
–  Particularly useful
in SOA
composites
–  Can correlate to
user via EM
11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Programatically Accessing the ECID
•  Potentially useful in some error messages
•  Code:
weblogic.diagnostics.context.
DiagnosticContextHelper.getContextId();
12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Integration with Enterprise Manager
13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Using the Logger
•  However, logging needs a degree of design
•  Consider
–  Placement
–  Message Level (use Config, Info, Warning, Error)
–  Detail / content
–  Message consumers [User Admin | Support | Developer]
14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Consider the Consumer of Logging / Messages
Developer
Support
Customer Admin
ERROR – APP001: Raise process for King did not complete
CONFIG – employee.class: updateSal():
Called with params: empId:101, newsal:<null>
WARNING – APP101: Raise failed for Employee King, empty
salary value passed to raise routine
INFO – employee.class: updateSal():
Setting commission to newSal * 0.1
ERROR – employee.class: updateSal(): NullPointerException
ERROR – APP001: Raise process for King did not complete
WARNING– APP101: Raise failed for Employee King, empty
salary value passed to raise routine
ERROR – NullPointerException
ERROR – APP001: Raise process for King did not complete
15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Logging Rules
•  Don’t over-log, it’s not a code coverage tool
•  Log message translation is possible but not necessary
•  Think about supportability
–  Assign error/warning codes to help in search, aimed at consumers and
support – document these!
–  Config / info messages don’t need this though
•  Use guard conditions around complex log statements
–  E.g. if you use a StringBuilder or call a separate log routine
16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Logging Rules continued
•  Use per-class loggers rather than a single utility* class
–  More granularity of control and filtering
•  Always log exceptions – even when a message is also sent to the UI
–  Log at Error or Warning as appropriate
–  Assume servers will normally be logging at Warning level
•  Don’t use logging as an audit
–  The app server administrator can switch it off
*NOTE: Bug 14283664 SOURCE CLASS AND METHOD ARGUMENTS PASSED TO ADFLOGGER METHODS ARE IGNORED
17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Where to Log?
•  As mentioned – any error condition
•  Parameters change, logic does not
–  So always log the inputs (and outputs) of significant routines
–  Particularly with re-usable components, e.g. Task Flows
•  State changes are interesting, steady state is not
–  State dumps could be a “special feature” executed on demand rather
than every time (beware of security concerns though)
•  Be cognizant of the number of times it will be invoked
–  e.g. Is a lifecycle listener such a good idea?
18 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Examples of Key Log Points
•  Task flows:
–  Initializer, Finalizer: Log the parameters / results
–  Error Handler
•  ADF BC
–  View Objects: bindParametersForCollection override for bind variable
values
–  Application Modules: doCheckout, prepareSession for tuning and PL/
SQL session setup in particular
–  Good candidates for your super-classes
19 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Examples of Key Log Points continued
•  Managed beans
–  Particularly useful in common constructor superclass to help understand
the lifecycle of beans
•  Override DCErrorHandlerImpl to catch ADFm exceptions
•  Timers / Async callbacks
–  Can identify sequence issues not visible in debug environment
20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
What not to Log?
•  Be aware that the framework is already instrumented
–  You may not want to duplicate that at the finest level
21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.21 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Any other ideas for good logging points or places
we should not log?
Image: imagerymajestic/ FreeDigitalPhotos.net
22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Program Agenda
•  Why instrument?
•  Logging design
•  Logging and the developer
23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
The Other Side of Logging
•  Well instrumented code can save a lot of time during development
–  Hot switchable – no need to start and stop the server
–  Faster than stepping through in the debugger*
•  Built-in logging can help with understanding Framework operation
and problems
•  Great tuning tool
–  Over execution of code becomes obvious
* However, this is not an excuse for not learning how to use the debugger properly
24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
•  Add an additional dimension to your guarded log condition to reflect
mode
if (_logger.isLoggable(Level.INFO) &&
context.isDevelopmentMode) {
StringBuilder logMsg =
new StringBuilder("Information:");
logMsg.append(...);
_logger.info(logMsg.toString());
}
Developer v’s Runtime Logging Mode
A pattern to consider
25 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ODL Analyzer in JDeveloper
•  Can search and
filter by level and
time
•  Can relate entries
by request and
time
•  See detail in the bottom pane inc. exceptions passed to the logger
26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Framework Logging
•  To gain real value, set the following to Config level in the ODL
logging configuration screen:
–  oracle.adf, oracle.adfinternal, oracle.jbo
•  Now you can trace by ADF Request
–  Relate each action to the lifecycle
–  See how long each one takes
–  Observe what gets refreshed / executed
•  Replaces the old –Djbo.debugoutput=console flag
–  No need to re-start the server
27 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.27 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
ADF Request Tracing
28 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Conclusion
•  Make logging simple and fun
–  Use the code templates to cut down on
keystrokes
•  Install permanent logger for your package root
–  Performance hit not an issue during development
–  Helps you appreciate when you have over-logged
•  Consider lifecycle based logging
•  Learn to use the analyzer
29 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Further Reading
•  Adventures in logging
–  https://blogs.oracle.com/groundside/entry/adventures_in_logging_index
•  Oracle ADF Developer Guide on OTN
–  "Testing and Debugging ADF Components"
•  JDeveloper Code Templates (download)
–  http://bit.ly/OhEFfJ
30 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

More Related Content

What's hot

Oracle ADF Architecture TV - Design - Project Dependencies
Oracle ADF Architecture TV - Design - Project DependenciesOracle ADF Architecture TV - Design - Project Dependencies
Oracle ADF Architecture TV - Design - Project Dependencies
Chris Muir
 
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsOracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Chris Muir
 
Oracle ADF Architecture TV - Development - Error Handling
Oracle ADF Architecture TV - Development - Error HandlingOracle ADF Architecture TV - Development - Error Handling
Oracle ADF Architecture TV - Development - Error Handling
Chris Muir
 
Oracle ADF Architecture TV - Design - Task Flow Navigation Options
Oracle ADF Architecture TV - Design - Task Flow Navigation OptionsOracle ADF Architecture TV - Design - Task Flow Navigation Options
Oracle ADF Architecture TV - Design - Task Flow Navigation Options
Chris Muir
 
Oracle ADF Architecture TV - Deployment - System Topologies
Oracle ADF Architecture TV - Deployment - System TopologiesOracle ADF Architecture TV - Deployment - System Topologies
Oracle ADF Architecture TV - Deployment - System Topologies
Chris Muir
 
Oracle ADF Architecture TV - Design - Designing for Security
Oracle ADF Architecture TV - Design - Designing for SecurityOracle ADF Architecture TV - Design - Designing for Security
Oracle ADF Architecture TV - Design - Designing for Security
Chris Muir
 
Oracle ADF Architecture TV - Design - ADF BC Application Module Design
Oracle ADF Architecture TV - Design - ADF BC Application Module DesignOracle ADF Architecture TV - Design - ADF BC Application Module Design
Oracle ADF Architecture TV - Design - ADF BC Application Module Design
Chris Muir
 
Oracle ADF Architecture TV - Design - ADF Architectural Patterns
Oracle ADF Architecture TV - Design - ADF Architectural PatternsOracle ADF Architecture TV - Design - ADF Architectural Patterns
Oracle ADF Architecture TV - Design - ADF Architectural Patterns
Chris Muir
 
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile IntegrationOracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Chris Muir
 
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with OracleMobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Chris Muir
 
Oracle ADF Architecture TV - Design - Application Customization and MDS
Oracle ADF Architecture TV - Design - Application Customization and MDSOracle ADF Architecture TV - Design - Application Customization and MDS
Oracle ADF Architecture TV - Design - Application Customization and MDS
Chris Muir
 
Oracle ADF Architecture TV - Design - ADF Reusable Artifacts
Oracle ADF Architecture TV - Design - ADF Reusable ArtifactsOracle ADF Architecture TV - Design - ADF Reusable Artifacts
Oracle ADF Architecture TV - Design - ADF Reusable Artifacts
Chris Muir
 
Oracle ADF Architecture TV - Design - Service Integration Architectures
Oracle ADF Architecture TV - Design - Service Integration ArchitecturesOracle ADF Architecture TV - Design - Service Integration Architectures
Oracle ADF Architecture TV - Design - Service Integration Architectures
Chris Muir
 
Oracle ADF Architecture TV - Design - Usability and Layout Design
Oracle ADF Architecture TV - Design - Usability and Layout DesignOracle ADF Architecture TV - Design - Usability and Layout Design
Oracle ADF Architecture TV - Design - Usability and Layout Design
Chris Muir
 
CRUX (CRUD meets UX) Case Study: Building a Modern Applications User Experien...
CRUX (CRUD meets UX) Case Study: Building a Modern Applications User Experien...CRUX (CRUD meets UX) Case Study: Building a Modern Applications User Experien...
CRUX (CRUD meets UX) Case Study: Building a Modern Applications User Experien...
Chris Muir
 
Oracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Oracle ADF Architecture TV - Development - Naming Conventions & Project LayoutsOracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Oracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Chris Muir
 
Oracle ADF Architecture TV - Design - ADF Service Architectures
Oracle ADF Architecture TV - Design - ADF Service ArchitecturesOracle ADF Architecture TV - Design - ADF Service Architectures
Oracle ADF Architecture TV - Design - ADF Service Architectures
Chris Muir
 
Oracle ADF Architecture TV - Design - Task Flow Overview
Oracle ADF Architecture TV - Design - Task Flow OverviewOracle ADF Architecture TV - Design - Task Flow Overview
Oracle ADF Architecture TV - Design - Task Flow Overview
Chris Muir
 
Let's Talk Mobile
Let's Talk MobileLet's Talk Mobile
Let's Talk Mobile
Chris Muir
 
Oracle REST Data Services
Oracle REST Data ServicesOracle REST Data Services
Oracle REST Data Services
Chris Muir
 

What's hot (20)

Oracle ADF Architecture TV - Design - Project Dependencies
Oracle ADF Architecture TV - Design - Project DependenciesOracle ADF Architecture TV - Design - Project Dependencies
Oracle ADF Architecture TV - Design - Project Dependencies
 
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsOracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
 
Oracle ADF Architecture TV - Development - Error Handling
Oracle ADF Architecture TV - Development - Error HandlingOracle ADF Architecture TV - Development - Error Handling
Oracle ADF Architecture TV - Development - Error Handling
 
Oracle ADF Architecture TV - Design - Task Flow Navigation Options
Oracle ADF Architecture TV - Design - Task Flow Navigation OptionsOracle ADF Architecture TV - Design - Task Flow Navigation Options
Oracle ADF Architecture TV - Design - Task Flow Navigation Options
 
Oracle ADF Architecture TV - Deployment - System Topologies
Oracle ADF Architecture TV - Deployment - System TopologiesOracle ADF Architecture TV - Deployment - System Topologies
Oracle ADF Architecture TV - Deployment - System Topologies
 
Oracle ADF Architecture TV - Design - Designing for Security
Oracle ADF Architecture TV - Design - Designing for SecurityOracle ADF Architecture TV - Design - Designing for Security
Oracle ADF Architecture TV - Design - Designing for Security
 
Oracle ADF Architecture TV - Design - ADF BC Application Module Design
Oracle ADF Architecture TV - Design - ADF BC Application Module DesignOracle ADF Architecture TV - Design - ADF BC Application Module Design
Oracle ADF Architecture TV - Design - ADF BC Application Module Design
 
Oracle ADF Architecture TV - Design - ADF Architectural Patterns
Oracle ADF Architecture TV - Design - ADF Architectural PatternsOracle ADF Architecture TV - Design - ADF Architectural Patterns
Oracle ADF Architecture TV - Design - ADF Architectural Patterns
 
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile IntegrationOracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
 
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with OracleMobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
 
Oracle ADF Architecture TV - Design - Application Customization and MDS
Oracle ADF Architecture TV - Design - Application Customization and MDSOracle ADF Architecture TV - Design - Application Customization and MDS
Oracle ADF Architecture TV - Design - Application Customization and MDS
 
Oracle ADF Architecture TV - Design - ADF Reusable Artifacts
Oracle ADF Architecture TV - Design - ADF Reusable ArtifactsOracle ADF Architecture TV - Design - ADF Reusable Artifacts
Oracle ADF Architecture TV - Design - ADF Reusable Artifacts
 
Oracle ADF Architecture TV - Design - Service Integration Architectures
Oracle ADF Architecture TV - Design - Service Integration ArchitecturesOracle ADF Architecture TV - Design - Service Integration Architectures
Oracle ADF Architecture TV - Design - Service Integration Architectures
 
Oracle ADF Architecture TV - Design - Usability and Layout Design
Oracle ADF Architecture TV - Design - Usability and Layout DesignOracle ADF Architecture TV - Design - Usability and Layout Design
Oracle ADF Architecture TV - Design - Usability and Layout Design
 
CRUX (CRUD meets UX) Case Study: Building a Modern Applications User Experien...
CRUX (CRUD meets UX) Case Study: Building a Modern Applications User Experien...CRUX (CRUD meets UX) Case Study: Building a Modern Applications User Experien...
CRUX (CRUD meets UX) Case Study: Building a Modern Applications User Experien...
 
Oracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Oracle ADF Architecture TV - Development - Naming Conventions & Project LayoutsOracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Oracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
 
Oracle ADF Architecture TV - Design - ADF Service Architectures
Oracle ADF Architecture TV - Design - ADF Service ArchitecturesOracle ADF Architecture TV - Design - ADF Service Architectures
Oracle ADF Architecture TV - Design - ADF Service Architectures
 
Oracle ADF Architecture TV - Design - Task Flow Overview
Oracle ADF Architecture TV - Design - Task Flow OverviewOracle ADF Architecture TV - Design - Task Flow Overview
Oracle ADF Architecture TV - Design - Task Flow Overview
 
Let's Talk Mobile
Let's Talk MobileLet's Talk Mobile
Let's Talk Mobile
 
Oracle REST Data Services
Oracle REST Data ServicesOracle REST Data Services
Oracle REST Data Services
 

Similar to Oracle ADF Architecture TV - Development - Logging

Developer day v2
Developer day v2Developer day v2
Developer day v2
AiougVizagChapter
 
The Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result CacheThe Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result Cache
Steven Feuerstein
 
Con8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2contentCon8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2content
Anil Nair
 
Primavera P6 Tips and Tricks
Primavera P6 Tips and TricksPrimavera P6 Tips and Tricks
Primavera P6 Tips and Tricks
p6academy
 
Oracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningOracle GoldenGate Performance Tuning
Oracle GoldenGate Performance Tuning
Bobby Curtis
 
IOUG at Coors Field ASH and AWR in EM12c!
IOUG at Coors Field ASH and AWR in EM12c!IOUG at Coors Field ASH and AWR in EM12c!
IOUG at Coors Field ASH and AWR in EM12c!
Kellyn Pot'Vin-Gorman
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014Dave Stokes
 
OUGLS 2016: How profiling works in MySQL
OUGLS 2016: How profiling works in MySQLOUGLS 2016: How profiling works in MySQL
OUGLS 2016: How profiling works in MySQL
Georgi Kodinov
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschema
Ivan Ma
 
Em13c features- HotSos 2016
Em13c features- HotSos 2016Em13c features- HotSos 2016
Em13c features- HotSos 2016
Kellyn Pot'Vin-Gorman
 
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
Dave Stokes
 
Performance tuning Grails Applications GR8Conf US 2014
Performance tuning Grails Applications GR8Conf US 2014Performance tuning Grails Applications GR8Conf US 2014
Performance tuning Grails Applications GR8Conf US 2014
Lari Hotari
 
Ebs performance tuning session feb 13 2013---Presented by Oracle
Ebs performance tuning session  feb 13 2013---Presented by OracleEbs performance tuning session  feb 13 2013---Presented by Oracle
Ebs performance tuning session feb 13 2013---Presented by OracleAkash Pramanik
 
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRsMySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
Mayank Prasad
 
Oracle Management Cloud
Oracle Management Cloud Oracle Management Cloud
Oracle Management Cloud
Dheeraj Hiremath
 
Oracle Management Cloud
Oracle Management CloudOracle Management Cloud
Oracle Management Cloud
Dheeraj Hiremath
 
Oracle Open World Exadata Monitoring and Management with EM12c
Oracle Open World Exadata Monitoring and Management with EM12cOracle Open World Exadata Monitoring and Management with EM12c
Oracle Open World Exadata Monitoring and Management with EM12c
Kellyn Pot'Vin-Gorman
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014
Lari Hotari
 
SQL TUNING 101
SQL TUNING 101SQL TUNING 101
SQL TUNING 101
Alex Zaballa
 
Adop and maintenance task presentation 151015
Adop and maintenance task presentation 151015Adop and maintenance task presentation 151015
Adop and maintenance task presentation 151015
andreas kuncoro
 

Similar to Oracle ADF Architecture TV - Development - Logging (20)

Developer day v2
Developer day v2Developer day v2
Developer day v2
 
The Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result CacheThe Amazing and Elegant PL/SQL Function Result Cache
The Amazing and Elegant PL/SQL Function Result Cache
 
Con8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2contentCon8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2content
 
Primavera P6 Tips and Tricks
Primavera P6 Tips and TricksPrimavera P6 Tips and Tricks
Primavera P6 Tips and Tricks
 
Oracle GoldenGate Performance Tuning
Oracle GoldenGate Performance TuningOracle GoldenGate Performance Tuning
Oracle GoldenGate Performance Tuning
 
IOUG at Coors Field ASH and AWR in EM12c!
IOUG at Coors Field ASH and AWR in EM12c!IOUG at Coors Field ASH and AWR in EM12c!
IOUG at Coors Field ASH and AWR in EM12c!
 
MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014MySQL 5.7 -- SCaLE Feb 2014
MySQL 5.7 -- SCaLE Feb 2014
 
OUGLS 2016: How profiling works in MySQL
OUGLS 2016: How profiling works in MySQLOUGLS 2016: How profiling works in MySQL
OUGLS 2016: How profiling works in MySQL
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema20150110 my sql-performanceschema
20150110 my sql-performanceschema
 
Em13c features- HotSos 2016
Em13c features- HotSos 2016Em13c features- HotSos 2016
Em13c features- HotSos 2016
 
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
MySQL 5.7 New Features to Exploit -- PHPTek/Chicago MySQL User Group May 2014
 
Performance tuning Grails Applications GR8Conf US 2014
Performance tuning Grails Applications GR8Conf US 2014Performance tuning Grails Applications GR8Conf US 2014
Performance tuning Grails Applications GR8Conf US 2014
 
Ebs performance tuning session feb 13 2013---Presented by Oracle
Ebs performance tuning session  feb 13 2013---Presented by OracleEbs performance tuning session  feb 13 2013---Presented by Oracle
Ebs performance tuning session feb 13 2013---Presented by Oracle
 
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRsMySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
 
Oracle Management Cloud
Oracle Management Cloud Oracle Management Cloud
Oracle Management Cloud
 
Oracle Management Cloud
Oracle Management CloudOracle Management Cloud
Oracle Management Cloud
 
Oracle Open World Exadata Monitoring and Management with EM12c
Oracle Open World Exadata Monitoring and Management with EM12cOracle Open World Exadata Monitoring and Management with EM12c
Oracle Open World Exadata Monitoring and Management with EM12c
 
Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014Performance tuning Grails applications SpringOne 2GX 2014
Performance tuning Grails applications SpringOne 2GX 2014
 
SQL TUNING 101
SQL TUNING 101SQL TUNING 101
SQL TUNING 101
 
Adop and maintenance task presentation 151015
Adop and maintenance task presentation 151015Adop and maintenance task presentation 151015
Adop and maintenance task presentation 151015
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 

Oracle ADF Architecture TV - Development - Logging

  • 1. 1 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
  • 2. 2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Real World ADF Design & Architecture Principles Error and Information Logging ORACLE PRODUCT LOGO 15th Feb 2013 v1.0
  • 3. 3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Learning Objectives •  At the end of this module you should be able to: –  Understand logging in Oracle ADF –  Know when to log and when to log –  Know how to read and analyze ADF logs Image: imagerymajestic/ FreeDigitalPhotos.net
  • 4. 4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Program Agenda •  Why instrument? •  Logging design •  Logging and the developer
  • 5. 5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Why Instrument Your Applications? •  It’s a great debugging aid for development –  But that is not the primary goal •  The dirty truth about end users: –  Use the application not your code – • They can’t explain what they are doing in a way that relates to what you’re looking at –  Don’t remember what they did to cause the error • “I didn’t do anything” –  They lie
  • 6. 6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Instrumentation Goals •  Help the intelligent site admin self diagnose –  Good logging should not assume that the reader has the source code •  Help your support organization make an educated guess –  Log messages are great search terms •  Help developers focus on the likely cause –  “How on earth is that parameter null….?” –  “What did you do before you didn’t do anything?”
  • 7. 7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.7 Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Wouldn't it be best to log everything that happens within an application to leave fine traces of what happens in case things go wrong? Image: imagerymajestic/ FreeDigitalPhotos.net
  • 8. 8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Program Agenda •  Why instrument? •  Logging design •  Logging and the developer
  • 9. 9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Why use the ADF Logger? •  System.out.println is not a logger! –  Cannot be switched off, filtered or easily captured •  Many Java logging implementations exist but you should use the ADF Logger –  It’s part of the framework, no extra libraries, no classloader issues –  Fully integrated with both JDeveloper and Enterprise Manager –  Integrates with FMW-wide logging infrastructure (ECID) –  Switchable at runtime –  Uses java.util.Logging under the covers
  • 10. 10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. What’s ECID? •  Execution Context ID –  Unique ID for a particular transaction (e.g. Web Request) •  64 bit identifier + Sequence –  Allows you to follow the trail of events in that transaction –  Particularly useful in SOA composites –  Can correlate to user via EM
  • 11. 11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Programatically Accessing the ECID •  Potentially useful in some error messages •  Code: weblogic.diagnostics.context. DiagnosticContextHelper.getContextId();
  • 12. 12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Integration with Enterprise Manager
  • 13. 13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Using the Logger •  However, logging needs a degree of design •  Consider –  Placement –  Message Level (use Config, Info, Warning, Error) –  Detail / content –  Message consumers [User Admin | Support | Developer]
  • 14. 14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Consider the Consumer of Logging / Messages Developer Support Customer Admin ERROR – APP001: Raise process for King did not complete CONFIG – employee.class: updateSal(): Called with params: empId:101, newsal:<null> WARNING – APP101: Raise failed for Employee King, empty salary value passed to raise routine INFO – employee.class: updateSal(): Setting commission to newSal * 0.1 ERROR – employee.class: updateSal(): NullPointerException ERROR – APP001: Raise process for King did not complete WARNING– APP101: Raise failed for Employee King, empty salary value passed to raise routine ERROR – NullPointerException ERROR – APP001: Raise process for King did not complete
  • 15. 15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Logging Rules •  Don’t over-log, it’s not a code coverage tool •  Log message translation is possible but not necessary •  Think about supportability –  Assign error/warning codes to help in search, aimed at consumers and support – document these! –  Config / info messages don’t need this though •  Use guard conditions around complex log statements –  E.g. if you use a StringBuilder or call a separate log routine
  • 16. 16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Logging Rules continued •  Use per-class loggers rather than a single utility* class –  More granularity of control and filtering •  Always log exceptions – even when a message is also sent to the UI –  Log at Error or Warning as appropriate –  Assume servers will normally be logging at Warning level •  Don’t use logging as an audit –  The app server administrator can switch it off *NOTE: Bug 14283664 SOURCE CLASS AND METHOD ARGUMENTS PASSED TO ADFLOGGER METHODS ARE IGNORED
  • 17. 17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Where to Log? •  As mentioned – any error condition •  Parameters change, logic does not –  So always log the inputs (and outputs) of significant routines –  Particularly with re-usable components, e.g. Task Flows •  State changes are interesting, steady state is not –  State dumps could be a “special feature” executed on demand rather than every time (beware of security concerns though) •  Be cognizant of the number of times it will be invoked –  e.g. Is a lifecycle listener such a good idea?
  • 18. 18 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Examples of Key Log Points •  Task flows: –  Initializer, Finalizer: Log the parameters / results –  Error Handler •  ADF BC –  View Objects: bindParametersForCollection override for bind variable values –  Application Modules: doCheckout, prepareSession for tuning and PL/ SQL session setup in particular –  Good candidates for your super-classes
  • 19. 19 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Examples of Key Log Points continued •  Managed beans –  Particularly useful in common constructor superclass to help understand the lifecycle of beans •  Override DCErrorHandlerImpl to catch ADFm exceptions •  Timers / Async callbacks –  Can identify sequence issues not visible in debug environment
  • 20. 20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. What not to Log? •  Be aware that the framework is already instrumented –  You may not want to duplicate that at the finest level
  • 21. 21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.21 Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Any other ideas for good logging points or places we should not log? Image: imagerymajestic/ FreeDigitalPhotos.net
  • 22. 22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Program Agenda •  Why instrument? •  Logging design •  Logging and the developer
  • 23. 23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. The Other Side of Logging •  Well instrumented code can save a lot of time during development –  Hot switchable – no need to start and stop the server –  Faster than stepping through in the debugger* •  Built-in logging can help with understanding Framework operation and problems •  Great tuning tool –  Over execution of code becomes obvious * However, this is not an excuse for not learning how to use the debugger properly
  • 24. 24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. •  Add an additional dimension to your guarded log condition to reflect mode if (_logger.isLoggable(Level.INFO) && context.isDevelopmentMode) { StringBuilder logMsg = new StringBuilder("Information:"); logMsg.append(...); _logger.info(logMsg.toString()); } Developer v’s Runtime Logging Mode A pattern to consider
  • 25. 25 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. ODL Analyzer in JDeveloper •  Can search and filter by level and time •  Can relate entries by request and time •  See detail in the bottom pane inc. exceptions passed to the logger
  • 26. 26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Framework Logging •  To gain real value, set the following to Config level in the ODL logging configuration screen: –  oracle.adf, oracle.adfinternal, oracle.jbo •  Now you can trace by ADF Request –  Relate each action to the lifecycle –  See how long each one takes –  Observe what gets refreshed / executed •  Replaces the old –Djbo.debugoutput=console flag –  No need to re-start the server
  • 27. 27 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.27 Copyright © 2011, Oracle and/or its affiliates. All rights reserved. ADF Request Tracing
  • 28. 28 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Conclusion •  Make logging simple and fun –  Use the code templates to cut down on keystrokes •  Install permanent logger for your package root –  Performance hit not an issue during development –  Helps you appreciate when you have over-logged •  Consider lifecycle based logging •  Learn to use the analyzer
  • 29. 29 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Further Reading •  Adventures in logging –  https://blogs.oracle.com/groundside/entry/adventures_in_logging_index •  Oracle ADF Developer Guide on OTN –  "Testing and Debugging ADF Components" •  JDeveloper Code Templates (download) –  http://bit.ly/OhEFfJ
  • 30. 30 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.