BBJSP Logging (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 17.0 and higher, the BBJSP framework provides a Logging mechanism that allows the generation of application-specific log files. Each BBjJettyContext has a unique log file and the logger class is available to all components running within that context.

The logging options are configurable through a context-specific web-config.xml and command-engine.xml configuration files where you will find the logging <groups> and <options> configurations. You can add your own options that will become available in your applications for custom logging.

Typical logging entries within web-config.xml:

<logging>
    <master-logging>true</master-logging>
    <servlet-context-logging>false</servlet-context-logging>
    <log-file-path>/opt/basis/log/store</log-file-path>
    <log-file-name>bbjsp-engine.log</log-file-name>
    <stdout-logging>false</stdout-logging>
    <stderr-logging>false</stderr-logging>
    <groups>
        <group enabled="true" name="INFO"/>
        <group enabled="true" name="DEBUG"/>
        <group enabled="true" name="ERROR"/>
    </groups>
    <options>
        <option enabled="true" group="INFO" name="BBJ_EMMITTER_INFO"/>
        <option enabled="true" group="DEBUG" name="BBJ_EMMITTER_DEBUG"/>
        <option enabled="true" group="ERROR" name="BBJ_EMMITTER_ERROR"/>
        <option enabled="true" group="INFO" name="BBJ_PARSER_INFO"/>
        <option enabled="true" group="DEBUG" name="BBJ_PARSER_DEBUG"/>
        <option enabled="true" group="ERROR" name="BBJ_PARSER_ERROR"/>
        <option enabled="true" group="INFO" name="BBJ_SERVLET_INFO"/>
        <option enabled="true" group="DEBUG" name="BBJ_SERVLET_DEBUG"/>
        <option enabled="true" group="ERROR" name="BBJ_SERVLET_ERROR"/>
        <option enabled="true" group="INFO" name="PERSISTER_INFO"/>
        <option enabled="true" group="DEBUG" name="PERSISTER_DEBUG"/>
        <option enabled="true" group="ERROR" name="PERSISTER_ERROR"/>
        <option enabled="true" group="INFO" name="PIPELINE_INFO"/>
        <option enabled="true" group="DEBUG" name="PIPELINE_DEBUG"/>
        <option enabled="true" group="ERROR" name="PIPELINE_ERROR"/>
    </options>
</logging>

A <group> is defines a named-group into which individual logging options are added. By disabling a group you disable all options within that group. You could add a custom group by inserting the following line:


<group enabled="true" name="USER"/>

An <option> can be added to and existing named-group and individually enabled according to your applications' needs.You could add a custom group by inserting the following line:


<option enabled="true" group="USER" name="USER_DEBUG"/>

Having created a new option and restarted the context you can then, within your BBJSP Pages and BBJSP Servlets generate logging entries that will go into the context's log file.

Within a BBJSP Page you could do something like this:


<%
  #PageContext!.getLogger().logIfOption("USER_DEBUG","THIS IS A USER LOG")
%>

Within a BBJSP Servlet you could do something like this:


context!.getLogger().logIfOption("USER_DEBUG","THIS IS A USER LOG")

Within a BBjspCommand you could do something like this:


context!.getLogger().logIfOption("USER_DEBUG","THIS IS A USER LOG")

See Also

BBJSP

BBjspLogger

BBjspLogManager