Thursday Aug 29, 2013

ADF Desktop Integration Client Logging

About
In general, when we encounter errors, we often tend to look at logs to get detailed information. Users of ADF Desktop Integration can also enable logging in both client-side and server-side. In this blog we will have a look on how to enable client-side logging.

Assumption
Let us assume an ADF application is created with Employees table using simple HR schema and ADFdi workbook is created and configured to use EmployeesView1 as ADF Table.

simple table-new.png

How to enable logging for all workbooks opened with installed client:

For Design time client, copy 'adfdi-excel-addin.dll.config' from "<JDEV_HOME>\jdeveloper\adfdi\bin\excel\samples to the directory mentioned under About ADF Desktop Integration dialog in Oracle ADF tab -> Properties tab -> Configuration property.

For Runtime client, copy 'adfdi-excel-addin.dll.config' from "<JDEV_HOME>\jdeveloper\adfdi\bin\excel\samples to the directory mentioned under About ADF Desktop Integration dialog in MyWorkbook tab -> Properties tab -> Configuration property and rename it as 'adfdi-excel-addin-runtime.dll.config'.

We will continue with the assumption that we have installed Design time client and hence will use adfdi-excel-addin.dll.config file.

In adfdi-excel-addin.dll.config file, we have an <add> tag inside <listeners> tag where we can set type, name, location and trace options of log file.
<add type="System.Diagnostics.DelimitedListTraceListener" name="adfdi-common-text-listener" initializeData="C:\temp\adfdi-common-excel.txt" delimiter="|" traceOutputOptions="ThreadId, ProcessId, DateTime"/>

type - determines type of logs. Logs can be obtained in 3 different formats:

  • System.Diagnostics.DelimitedListTraceListener - Default format. Logs will be obtained with the specified delimiter.
  • System.Diagnostics.XmlWriterTraceListener - Logs will be obtained in xml format.
  • System.Diagnostics.TextWriterTraceListener - Logs will be obtained in Text format.

name - name of the trace listener. Can be set to any value

initializeData - determines the path where the log file has to be generated. Valid path has to be mentioned.

delimiter - specified character is used as a delimiter when type is set to 'System.Diagnostics.DelimitedListTraceListener'. It is not required to be set for other types.

traceOutputOptions - determines the optional content of trace output. If no extra details are required, it can be set to "None"

Different levels of logging can be set by chaning the switchValue property inside <source> tag. By default it is set to Information and logging can be turned off by setting switchValue = Off

Once after setting switchValue save the config file. Open the adfdi workbook and click on Refresh Config button in Logging section of Oracle ADF ribbbon tab.

  • With switchValue = Information - Information, warning and error messages will be logged in the log file.
    Eg: In excel workbook, add an ADF Input Text into cell J5. Select the same cell (J5) and insert ADF Button Component. A warning will be displayed.
    In C:\temp\adfdi-commom-excel.txt log file, logs similar to below will be seen:
    ~~~~~~~~~~~~~~~~~~~~~~
    "adfdi-common"|Warning|3|"A component already exists at origin J5."||7284||"1"|"2013-08-23T10:28:15.2851735Z"||
    ~~~~~~~~~~~~~~~~~~~~~~
  • With switchValue = Warning - Warning and error messages will be logged into log file.
    Eg: Edit ADF Table properties by double-clicking any cell in table range, and open Edit Columns by clicking on button on RHS of Columns property. Select FirstName column and set the value of DynaminColumn property to True. Close all dialogs by giving OK and run the workbook.
    In C:\temp\adfdi-commom-excel.txt log file, logs similar to below will be seen:
    ~~~~~~~~~~~~~~~~~~~~~~
    "adfdi-common"|Warning|3|"ADFDI-07520: Unable to evaluate the expression '#{bindings.EmployeesView1.hints.FirstName.label}' in 'Sheet1.TAB429819356.FirstName.HeaderLabel'. Detail: "||6352||"1"|"2013-08-23T10:40:16.0642489Z"||
    ~~~~~~~~~~~~~~~~~~~~~~
  • With switchValue = Error - only error/exception messages will be logged into log file.
    Eg: Run the workbook. Click on Edit Options in MyWorkbook tab and enter an invalid webapproot (say add 1 at end). Click on OK and click Yes in Web App Root confirmation dialog. ConnectionFailedException will be seen.

    In C:\temp\adfdi-commom-excel.txt log file, logs similar to below will be seen:
    ~~~~~~~~~~~~~~~~~~~~~~
    "adfdi-common"|Error|2|"ADFDI-05530: unable to initialize worksheet: Sheet1
    ADFDI-00134: An attempt to connect to the web application has failed.
    ADFDI-00501: An unexpected status: 404 (NotFound) was returned from the server while requesting the URL: http://127.0.0.1:7101/BlogApplication-ViewController-context-root1/adfdiRemoteServlet

    ~~~~~~~~~~
    ConnectionFailedException: ADFDI-00134: An attempt to connect to the web application has failed.
    Source: adfdi-datamanager
    Stack:
    at oracle.adf.client.windows.datamanager.LoginHandler.GetAuthenticationMode()
    at oracle.adf.client.windows.datamanager.LoginHandler.Login()
    at oracle.adf.client.windows.datamanager.ADFBindingContext.LoginHandlerProxy.Login()
    at oracle.adf.client.windows.datamanager.ADFBindingContext.AttemptLogin(Boolean maybeHadSession)
    at oracle.adf.client.windows.datamanager.ADFBindingContext.SyncModel(BindingContainer bc, String contentType)
    at oracle.adf.client.windows.datamanager.BindingContainer.ReloadMetadata()
    at oracle.adf.client.windows.excel.runtime.DIWorksheet.InitializeComponents(Boolean isFirstLoad)
    at oracle.adf.client.windows.excel.runtime.DIWorksheet.Initialize(Boolean initializeUI)
    Inner:
    UnexpectedHttpStatusException: ADFDI-00501: An unexpected status: 404 (NotFound) was returned from the server while requesting the URL: http://127.0.0.1:7101/BlogApplication-ViewController-context-root1/adfdiRemoteServlet
    Source: adfdi-datamanager
    Stack:
    at oracle.adf.client.windows.datamanager.LoginHandler.GetAuthenticationMode()
    ~~~~~~~~~~~~~~~~~~~~~~
  • With switchValue = Verbose - detailed information about the workbook events including warning, information and errors will be seen with delimiter in log file.
    Eg: Run the workbook and perform Download by clicking on Download ribbon command. Enter an invalid value for FirstName(say 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa') and perform Upload by clicking on Upload ribbon command. Upload will fail as FirstName has invalid precision/scale.
    In C:\temp\adfdi-commom-excel.txt log file, all details in About dialog will be logged similar to below :
    ~~~~~~~~~~~~~~~~~~~~~~
    "adfdi-common"|Verbose|5|"oacw.datamanager.BindingContainer.AppendExceptionToList: Exception received from server: localized message: JBO-27023: Failed to validate all rows in a transaction.; display message: null; java class name: oracle.jbo.TxnValException; cause: null
    product code: JBO; error code: 27023; severity: Error; row key: null; attribute id: null;
    Detail: localized message: JBO-27024: Failed to validate a row with key oracle.jbo.Key[100 ] in AppModule.EmployeesView1; display message: null; java class name: oracle.jbo.RowValException; cause: null
    product code: JBO; error code: 27024; severity: Error; row key: 00010000000AACED0005770400000064; attribute id: null;
    Detail: localized message: JBO-27010: Attribute set with value aaaaaaaaaaaaaaaaaaaaaaaaaaaa for FirstName in AppModule.EmployeesView1 has invalid precision/scale; display message: Attribute set with value aaaaaaaaaaaaaaaaaaaaaaaaaaaa for FirstName in AppModule.EmployeesView1 has invalid precision/scale; java class name: oracle.jbo.PrecisionScaleValidationException; cause: null
    product code: JBO; error code: 27010; severity: Error; row key: null; attribute id: FirstName; Details: null"||12780||"1"|"2013-08-23T13:10:38.8164715Z"||
    ~~~~~~~~~~~~~~~~~~~~~~

How to enable logging for a particular session:

This type of logging can be used only for DT/TST mode and cannot be used for RT mode. This logging is of major help when we want detailed log messages for a specific usecase/error.

On opening ADFdi enabled excel workbook, under Oracle ADF ribbon tab, there will be Logging section with buttons for Console, Set Output Level, Add Log Output File and Refresh Config

Logging-latest.png

Clicking on Console button, opens up Logging Console non-modal dialog. By default the logging level is set to Off and hence no logs will be seen.

logging console-latest.png

Logging levels can be set either by clicking Set Output Level in Logging section of Oracle ADF tab or by clicking Set Level in Logging Console dialog.

Logging levels-latest.png

Logs can also be saved in a file by specifying file name and location in 'Add New Temporary Logging Output File' dialog by clicking on 'Add Log Output File' button in Logging section of Oracle ADF tab.

log output file format -latest.png

The format of log can also be changed by selecting Text/XML from Output Type as seen in above image.

Through these ways we can enable client-side logging for ADF Desktop Integration to trace down the error /exception we get during development / testing / debugging the workbook.

About

Tips and Tricks from Oracle's JDeveloper & ADF QA

Search

Archives
« August 2013 »
SunMonTueWedThuFriSat
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
30
31
       
Today