X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

Using ADF logger with Groovy in ADF BC

Frank Nimphius
Master Principal Product Manager

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

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.