Sunday, February 15, 2015

ADFLogger 12.1.3 ignoring message parameters and resource keys

In JDeveloper 12.1.3 Oracle made a switch to a new log formatter that has its shortcomings. It no longer knows how to replace resource bundle keys with their actual message and also fails to replace the {0}, {1}, ... placeholders with their actual values. You can end up with logging looking like this:
<oracle.adf.view> <RichRenderKit> <isAutomationEnabled> <AUTOMATION_ENABLED_WITHOUT_AUTOMATION_JAR> 
<oracle.adf.common> <ADFConfigFactory> <findOrCreateADFConfig> <Resource {0} not found on the classpath.> 

Notice the AUTOMATION_ENABLED_WITHOUT_AUTOMATION_JAR that is not replaced with its actual message as well as the Resource {0}... message which should clearly mention the missing resource.

I don't know how this made it past basic QA, but this is now the default configuration for your Integrated WebLogic server in JDeveloper 12.1.3. Luckily there is an easy fix to revert to the 12.1.2 behaviour which is working fine.

Either start your integrated weblogic server in JDeveloper and click the actions button the log window and select Configure Oracle Diagnostics Logging or directly edit the JDEV_USER_HOME/system12. file.

Find the log_handler declaration at the beginning of the file for the console-handler. Change its formatter attribute from oracle.adf.share.logging.internal.diagnostic.ConsoleFormatter to oracle.core.ojdl.weblogic.ConsoleFormatter.

Restart your integrated weblogic server for the changes to take effect. You can now notice the resource keys and message parameters are correctly replaced:
<Feb 15, 2015 3:59:01 PM CET> <Warning> <> <ADF_FACES-60118> <Your application is running with the automation enabled in your web.xml file but the automation jar is unavailable. Please ensure that the jar is in the classpath.> 
<Feb 15, 2015 3:59:01 PM CET> <Warning> <oracle.adf.share.config.ADFConfigFactory> <BEA-000000> <Resource META-INF/adf-config.xml not found on the classpath.>