Logging in JDeveloper 11g / WebLogic Server

Erwin Vrielink 4

When developing an application it makes sense to add logging to this application. The Apache Commons Logging is a way to implement logging to your application independent of the eventually used implementation. While adding log messages to a Fusion Web Application (ADF) and running this application with JDeveloper the logging is not displayed in the application log window. This is not what expected en certainly undesirable.

The Apache commons logging is a wrapper around a third party logging implementation. Well the only thing we have to do is configuring this to use the Weblogic Logging implementation. so lets go:
I created a standard Fusion Web Application (ADF) with a default model and a viewController project.
Add the “Commons Logging 1.0.4” library to both projects  (Project -> properties -> Libraries and Classpath -> Add Library…)
It’s now possible to add logging to your application. I have added logging to my application module (nl.amis.wlslogging.model.ApplicationModuleImpl) like:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public AppModuleImpl() {
    sLog.debug("Application Module created.");
This will compile and run, but is this debug-message displayed? The answer is no, we didn’t configure a Logging implementation to the Apache Commons Logging. We have to add a “commons-logging.properties” configuration file to the src directory of both the Model and the ViewController projects. This properties file contains only one line:
This tells the Apache Commons Logging framework which log implementation to use. In this case an implementation for the WebLogic Application server. But when running this application an exception is raised, because of the unknown implementation class: weblogic.logging.commons.LogFactoryImpl.

We have to add the implementation class(es) to our project. Define in JDeveloper a new Library for this and assign it to both projects. The Library must contain the <JDEV_HOME>\modules\com.bea.core.weblogic.commons.logging_1.3.0.0.jar.

Strictly it’s not necessary to add this library to the ViewControler project while this project depends on the Model project with the library added already.
When running the Business Components Tester, by running the Application Module, the message is showed as expected. But when running the application, from the ViewController project, there is no debug-message showed in the application log window. For this we have to configure the Weblogic Server. Start the Weblogic application server either by running the View Controller project or start the application server by Run -> Start server Instance.  Open the WebLogic Console (default: http://localhost:7101/console) and choose to configure the DefaultServer via Environment/Servers. In the advanced section of the Logging tab, you can configure the logging options. With the Logger severity properties it’s possible to assign a log level to s specific class structure. By adding nl.amis=Debug all messages with severity debug or higher from classes beneath nl.amis are displayed when running the application.

Example log configuration:

4 thoughts on “Logging in JDeveloper 11g / WebLogic Server

  1. Erwin, I did exactly as you mentioned. But, it throws the following exception. (Caused by java.lang.ClassNotFoundException: weblogic.logging.commons.LogFactoryImpl)

    public String commandButton1_action() {
    LogFactory factory = LogFactory.getFactory();
    Log log = factory.getInstance(GetOrder.class)

  2. Phil,
    I am using JDeveloper version
    It’s te same construction I used to obtain a Logger object: private final Log sLog = LogFactory.getLog(ManagedBean.class);
    Be sure that the commons-logging.properties are directly in the source directories of both (Model and ViewController) projects.
    Will send you a zipfile with my application by email.
    Kind regards Erwin

  3. Hum, which version of Jdev 11 are you using? I followed your steps but could not make it work. How did you get sLog object? I assume from LogFactory.getLog(myObject.class), correct? The commons-logging.properties you mentioned don’t get picked up by EAR file.

Comments are closed.

Next Post

Asynchronous processing in Java applications - leveraging those multi-cores

  Processors are not going to get much faster. No higher clockspeeds are foreseen. The speed of processing will be further increasing through parallellization, engaging multiple CPU cores for handling all tasks rather than a single faster core.   This is but one reason for taking a closer look at […]
%d bloggers like this: