WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

This document provides an overview of the logging capabilities in NetKernel.

The core system logs to the NetKernel System Log.

This log is configured by the file [install]/etc/KernelLogConfig.xml. By default it logs to stderr and to a rolling file in the

[install]

/log/ directory.

Configuration Syntax

The NetKernel system log and application logs use a common configuration syntax. This defines the id, name and handlers for the log.

Log configuration files for application logs are by default located at:

res:/etc/system/LogConfig.xml. However alternate locations can be specified to allow an application to support writing to multiple logs.

<log>
  <id>NetKernel</id>
  <name>NetKernel System Log</name>
  <handlers>
    <handler>
      <instance>
        <class>org.netkernel.layer0.logging.LogFileHandler</class>
        <string>%b/log/netkernel-%g.log</string>
        <int>50000000</int>
        <int>3</int>
        <boolean>true</boolean>
      </instance>
      <formatterClass>org.netkernel.layer0.logging.XMLFormatter</formatterClass>
    </handler>
    <handler>
      <instance>
        <class>java.util.logging.ConsoleHandler</class>
      </instance>
      <formatterClass>org.netkernel.layer0.logging.ConsoleFormatter</formatterClass>
    </handler>
  </handlers>
</log>

If no log configuration is specified in an particular module which is attempting to log then the log configuration is resolved in the Scope of the request, this results in the nearest module which specifies a log configuration to be used. The log configuration isn't resolved and requested like regular resource because the Java logging infrastructure doesn't allow that kind of sophistication. The implication of this is that the file must physically exist in module with the specified path. Imports and filesets etc within the module definition will not effect the operation.

Resource Bundles

Resource Bundles can be specified by a resource res:/etc/messages.properties within application modules. These are resolved within the request scope of an endpoint.

Resource Bundles follow the standard syntax of:

MESSAGE_KEY=message text

and can contain parameter substitutions using %1, %2, %3 etc.

Logging from NKF

The INKFRequestContext extends the INKFLocale interface. This provides a set of methods for formatting messages using the resolved resource bundle, logging messages and creating exceptions with formatted messages.

Tools

Setting which levels of logging levels we be logged is configured using the Logging Levels panel on the control panel. These settings are persisted. When a log is first created all levels are enabled

Logs which write using LogFileHandler with the XMLFormatter can be read using the Log Viewer panel in the control panel. If your log doesn't appear on this panel ensure it has this handler.