Configuring logging in the development server

Information about the default logging settings for the embedded development server, and procedures for changing them.

When you are trying to diagnose problems in the MobileFirst Studio embedded test server (for example, when debugging a custom login module), it is important to be able to see log messages. The default settings for server logging are described in this section, along with the procedures for changing them if you must see finer levels of messages.

In previous releases of MobileFirst Studio, the embedded Jetty test server did not allow viewing the server logs. In Worklight Studio V6.0.0, the test server was replaced with an instance of the WebSphere® Application Server Liberty profile server and is now referred to as the MobileFirst Development Server.

Logging levels for the MobileFirst Studio plugin and builder can be configured with a new file named logging.properties. This file is in the .metadata folder of your Eclipse workspace.

For example, if your MobileFirst Studio workspace is /usr/workspace (on UNIX) or C:\workspace (on Windows), the corresponding logging configuration file is /usr/workspace/.metadata/logging.properties or C:\workspace\.metadata\logging.properties.

This file contains the following default settings:
handlers = java.util.logging.FileHandler
.level = WARNING
com.worklight.level = INFO

Changing the MobileFirst Operations Console logging levels

To change the logging level for all packages in this instance of Eclipse, edit the .level = line. To change the logging level only for MobileFirst Studio, edit the com.worklight.level = line.

The available setting levels for com.worklight.level = are:
  • SEVERE (highest value)
  • WARNING
  • INFO
  • CONFIG
  • FINE
  • FINER
  • FINEST (lowest value) 
In addition, there is an ALL level that specifies logging of all messages, and an OFF level that turns off logging.

If you edit the logging.properties file to change the logging level, you must restart MobileFirst Studio before the change takes effect.

Whatever the logging level, the messages are displayed in MobileFirst Studio in its console view with the name MobileFirst Console, as shown in the following screen capture:

MobileFirst Operations Console

Changing the logging levels of a web application in Liberty profile

Changing the logging properties for individual application server types is done with those servers' administration tools.

To provide two examples for WebSphere Application Server Liberty profile, the server.xml file can be modified by appending the new logging element:
  • To enable the INFO logging level for the server console, the following line is added to the server.xml file: 
    <logging consoleLogLevel="INFO"/>
  • To enable trace log files, the following line is added to the server.xml file:
    <logging traceSpecification="*=audit=enabled:com.worklight.*=info=enabled" />
The available setting levels for consoleLogLevel are:
  • INFO
  • AUDIT
  • WARNING
  • ERROR
  • OFF
This parameter does not support DEBUG level logging.

No server restart is necessary after you modify these settings.

Whatever the logging level, the messages are displayed in MobileFirst Studio in its console view with the name MobileFirst Development Server, as shown in the following screen capture:

MobileFirst Server Console

This console view allows you to see messages from the MobileFirst Development Server, but with some known limitations:
  • Localized log messages are shown incorrectly. For more information about this issue, see Liberty profile: Trace and logging.
  • Setting the value of consoleLogLevel to WARNING, ERROR, or OFF causes the server not to start from MobileFirst Studio using the Eclipse servers view.

Trace log messages are written to the trace.log file only. This logging trace is optional and supports fine-tuning such as packaging and more precise reporting levels, and is mainly used for debugging.

The trace*.log file is found under your Eclipse workspace in the folder WorklightServerConfig\servers\worklight\logs\.

For example, if your MobileFirst Studio workspace is /usr/workspace (on UNIX) or C:\workspace (on Windows), the log files are created under /usr/workspace/WorklightServerConfig/servers/worklight/logs/ or C:\workspace\WorklightServerConfig\servers\worklight\logs\.

The available setting levels for <logging traceSpecification="*=audit=enabled:com.worklight.*=info=enabled" /> are:
  • Off - No events are logged.
  • Fatal - Task cannot continue and component cannot function.
  • Severe - Task cannot continue, but component can still function.
  • Warning - Potential error or impending error.
  • Audit - Significant event affecting server state or resources.
  • Info - General information outlining overall task progress.
  • Config - Configuration change or status.
  • Detail - General information detailing subtask progress.
  • Fine - Trace information - General trace.
  • Finer - Trace information - Detailed trace + method entry / exit / return values.
  • Finest - Trace information - A more detailed trace - Includes all the detail that is needed to debug problems.
  • All - All events are logged. If you create custom levels, All includes your custom levels, and can provide a more detailed trace than Finest.

For more information about WebSphere Application Server Liberty profile logging configuration, see Liberty profile: Trace and logging.