Generate log messages

Log messages in the JVP log file can originate from any of the following sources:
  • The JVP
    JVP messages report such conditions as:
    • JVP status (such as boot progress)
    • Warnings about missing or limited resources
    • Execution errors (such as being unable to locate a UDR)
    • Internal errors (such as unexpected exceptions)

    JVP log messages that report serious errors usually print a Java-method stack trace.

  • The UDR

    Log messages from the UDR are messages that make sense only in the JVP and Java™ domain or that can complement the messages from SQL or the database server with annotations and references that are specific to Java code or the JVP.

    Following methods are deprecated:
    • UDRLog.log()
    • UDRTraceable.tracePrint()
By default, the JVP sends output to the following log file:
$ONEDB_HOME/tmp/jvp.log
Restriction: Do not use the JVP log for error messages that need to be reported to the client application or to the main online.log file. Instead, the method throws an SQLException.

Using Logback for logging messages

J/Foundation uses Logback and SLF4J to log messages to a log file. You can change the properties of how J/Foundation log messages by editing the $ONEDB_HOME/extend/krakatoa/logback.xml file.

Log Rotation

Log rotation is done now in the logback.xml file. An example log rotation appender section is provided in the default logback.xml that is shipped with Informix. You can switch between the default file appender and the rotating file appender.

The logback.xml file contains the log file location, pattern to encode a logged message, and the logging levels you want printed to the log. By default, the logback.xml file logs messages to $ONEDB_HOME/tmp/jvp.log, uses a default log level of "INFO" and has set the JDBC log level to "WARN".

Sample logback.xml file:

<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <append>true</append>
    <file>/tmp/jvp.log</file>
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>
  <!--
  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>$ONEDB_HOMErollingjvp.log</file>
    <append>true</append>
    <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
        <fileNamePattern>/tmp/rollingjvp%d{yyyy-MM-dd}.%i.log</fileNamePattern>
        <maxFileSize>50MB</maxFileSize>
        <maxHistory>30</maxHistory>
    </rollingPolicy>
    <encoder>
        <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>
  -->
  <!-- The base logging level is set here -->
  <!-- You can choose from (TRACE, DEBUG, INFO, WARN, ERROR) -->
  <root level="INFO">
    <appender-ref ref="FILE" />
  </root>
<logger name="com.informix.jdbc" level=“WARN" />
</configuration>

You can change the logging level of J/Foundation as a whole or a specific Java package by adding <logger> sections to the logback.xml file. You can provide a package name or a fully qualified class name which allows you to customize messages for parts of J/Foundation or for certain UDR's.

For more information about LOGBack and its configuration options at https://logback.qos.ch/manual/index.html.

Restriction:Do not use the JVP log for error messages that need to be reported to the client application or to the main online.log file. Instead, you can throw a SQLException.