Tuesday Nov 01, 2011

Using ADF logger with Groovy in ADF BC

Groovy is a scripting language that can be used in the context of ADF BC. It simplifies Java object access and method execution. Basically everything you could access from Java you can access from Groovy. If logging is needed in your Groovy scripting, then this can be achieved using the ADF Logger as shown below. Just add script similar to this into the Groovy code are (e..g when working with custom entity validators)

//log information to console. Create a logger instance for
//the entity class – "Employees in this sample

oracle.adf.share.logging.ADFLogger LOGGER =
oracle.adf.share.logging.ADFLogger.
createADFLogger(source.getClass())

LOGGER.info("Groovy Log Statement: oldValue and newValue in Validdator
"+oldValue+" ---> "+newValue)

LOGGER.info("Groovy Log Statement: All salaries in Department
"+Departments1.Employees1.sum('Salary'))

LOGGER.info("Groovy Log Statement: current budget "+(100000 -
(Departments1.Employees1.sum('Salary')+ newValue) + oldValue ))

Like In Java, you define a variable to hold the logger reference to then use it to print info messages

About

The Oracle JDeveloper forum ranks in the Top 5 of the most active forums on the Oracle Technology Network (OTN).



The OTN Harvest blog is a summary of selected topics posted on the OTN Oracle JDeveloper forum.



It is an effort to turn knowledge exchange into an interesting read for developers who enjoy little nuggets of wisdom





Frank Nimphius

Search

Archives
« April 2014
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
29
30
   
       
Today