Insights of ADF logging in ADF Framework

Logging is an important in debugging and tracing the issue.In Adf framework we have ADF logger.
How to use it ADF logger in ADF application.Hopefully , after reading you will have a good idea on it.

Q) How to Turn On Diagnostic Logging

To turn on diagnostic logging, set the Java system property named
jbo.debugoutput to the value console. Additionally, the value ADFLogger lets
you route diagnostics through the standard Logger implementation, which can be
controlled in a standard way through the logging.xml file
Inside JDeveloper is to edit your project properties and in the Run/Debug page, select a run
configuration and click Edit. Then add the string -Djbo.debugoutput=console to
the Java Options field.

Q)How to locate the logging.xml

There are following two ways to get to the logging configuration screen.
1. Open the Application Server Navigator (Ctrl + Shift + G), right mouse click on the IntegratedWeblogicServer and select Configure Oracle Diagnostic Logging for “IntegratedWeblogicServer”.
2. From the Log window (usually docked underneath your editor) pull down the Actions menu and select Configure Oracle diagnostic Logging.

How to configure log level
we need to set the log Level to at least FINE. Let’s set it to the most detailed level FINEST – TRACE:32 or anything you want to set ,if using ODL Log Levels – for the oracle.jbo logger.

If you are using Integrated WebLogic Server in JDeveloper on the Windows platform,
you can find the logging.xml file in a location similar to:
C:\Documents and Settings\username\ApplicationData\JDeveloper\latest_system_folder\DefaultDomain\config\fmwconfig\servers\DefaultServer The log files for Integrated WebLogic Server are in a location similar to:
C:\Documents and Settings\username\ApplicationData\JDeveloper\latest_system_folder\DefaultDomain\servers\DefaultServer\logs

The log files for a standalone WebLogic Server instance are in a location similar to:
$domain_home/servers/your_servername/logs

In the Project Properties dialog, click the Run/Debug/Profile node and create a
new run configuration.. In the Run Configurations list, double-click the new run configuration to edit its
properties.4. In the Edit Run Configuration dialog, for Launch Settings, enter the following
Java options for the default virtual machine:
-Djbo.debugoutput=adflogger -Djbo.adflogger.level=FINE
Set the level=FINE for detailed diagnostic messages
With this the setup is completed. Now open the file (AM, bean or any java class) which belongs to above package and add log messages as shown in below sample file.

LogLevelMapping

You need to set logging in your java classes as below this.

private static final ADFLogger logger= ADFLogger.createADFLogger("Implementation class vinay.class");

createADFLogger() function will create the logger instance .
After initializing the logger, you can use logging within the method as

private static ADFLogger log= ADFLogger.createADFLogger(GammaAMImpl.class);  
For debug messages in try block/ normal debug messages , write  
if(log.isFine()){ log.fine(String classname,String methodname,String message); }  


One important thing ,you need to include the package directory of the implementation project in Logging.xml for adfLogger.

I have used a lot log4j in my jee application.Then why I should use ADF logger compare to log4j.I found view of some adf expert on internet .So sharing with you all. Not sure about all the points:-

Pros to use ADFLogger:

– You can control trace level in Oracle Fusion Middleware Console (Enterprise Manager) with a visual interface.
– You have support by Oracle if you are having problems with logging solution.
– You have an ADFLogger for JavaScript too.
– Have more trace level’s than log4j.

Cons to use ADFLogger:

– You need to associate ADF libraries to your PDK’s.

Pros to use log4j:

– Best known for most developers.
– Easy to set different log strategies and file sizes.
– Goog performance.
– Easy to extend and use Wrappers with it.

Cons to use log4j:

– You can’t control trace level with visual interface provided by Oracle. You need to change manually log4j.properties
– You haven’t Oracle Support for log4j.

It’s only my own opinion. To me is recommended to use ADFLogger if you are in ADF Application. If you are in a JSR-168 or another application use log4j instead of ADFLogger.

Remove duplicate entries in a Vector in java

One of the solution which normally every java developer faced once.We have to remove the duplicate
value from a vector in java.

There are two solution for it one.

1.

Vector newVect = new Vector(new LinkedHashSet(originalVect));


or this, if you do not need a new Vector object created

2

Collection noDup = new LinkedHashSet(vectorContainingDup);
vectorContainingDup.clear();
vectorContainingDup.addAll(noDup);

In both cases we puting duplicate vector in linkedHashSet , which will remove the duplicate values.

Enjoy coding 🙂 with techartifact………………………….

Q: What are different Task Flow Component?

Method call-Provide a way to execute code within the flow.
Router – Provided way to branch the flow based on condition or by el.
Save Point Restore: Allows developer to take a snapshot of and ,then resotre,application state at specific point in flow.
Task Flow Call-Allow task flow to be called from this task flow.
URL View-Way to reach out the flow and potentiallu out og web application to some arbitrary URL such as http://www.techartifact.com
View:Allow display of page and page fragment.
Control Flow Case: Define flow between two activies.Similar to navigation case in ADF 10g or default jsf navigation engine.
WildCard Control Flow Rule: Provides way to define an origin for one or more global control flow cases that are shared and available from multiple activities on the diagram.