How to suppress the StreamBase log file default-engine-for-*.log

How to suppress the StreamBase log file default-engine-for-*.log

book

Article ID: KB0079982

calendar_today

Updated On:

Products Versions
TIBCO Streaming 10

Description

When including a custom Logback logging configuration in the StreamBase application, an extra log file appears in the node directory logs/ folder called "default-engine-for-*.log". Is there a way to prevent this log file from being created?

Issue/Introduction

Configuration guidance

Resolution

In the logback.xml configuration, if none of the "root" appenders write events into the node's logs/ folder, the StreamBase Runtime will create a default file appender writing into the logs/ folder. This file is named default-engine-for-*.log. This is so the Runtime can guarantee the presence a log file in a "snapshot archive" used for troubleshooting any server problems.

The only way to suppress the creation of a default log file in the logs/ folder is for the root appender to create at least one file in the logs/ folder.

If the size of the log file is a concern, limit the information which goes into the root log file using a configuration like this which redirects most of the information to log files external to the node using file rolling and compression (example logback.xml of alternate file appenders):
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="5 seconds">

  <!-- 
  Example simple file appender into the node logs/ directory
  This replaces the default-engine-for-*.log with only ERROR-level output.
   -->
  <appender name="errlog" class="ch.qos.logback.core.FileAppender">
    <file>logs/err.log</file>
    <append>true</append>
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
      <level>ERROR</level>
      <onMatch>ACCEPT</onMatch>
      <onMismatch>DENY</onMismatch>
    </filter>    
    <encoder>
      <pattern>%d{yyyy-MM-dd HH:mm:ss.}%usecs%d{Z} [%process:%thread] %-5level %logger: %msg%n</pattern>
    </encoder>
  </appender>

  <!-- 
  Example Daily Rolling file appender into a directory external to the node for all INFO level messages.
   -->
  <appender name="infolog" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <append>true</append>
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
      <level>INFO</level>
      <onMatch>ACCEPT</onMatch>
      <onMismatch>DENY</onMismatch>
    </filter>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <fileNamePattern>C:/tmp/infolog-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
    </rollingPolicy>
    <encoder>
      <pattern>%d{yyyy-MM-dd HH:mm:ss.}%usecs%d{Z} [%process:%thread] %-5level %logger: %msg%n</pattern>
    </encoder>
  </appender>  

  <!-- 
  Example File-size Rolling file appender into a directory external to the node for all WARN level messages.
   -->
  <appender name="warnlog" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>C:/tmp/warnlog.log</file>
    <append>true</append>
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
      <level>WARN</level>
      <onMatch>ACCEPT</onMatch>
      <onMismatch>DENY</onMismatch>
    </filter>
    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <fileNamePattern>C:/tmp/warnlog-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
      <minIndex>1</minIndex>
      <maxIndex>9</maxIndex>
    </rollingPolicy>
    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <maxFileSize>10MB</maxFileSize>
    </triggeringPolicy>    
    <encoder>
      <pattern>%d{yyyy-MM-dd HH:mm:ss.}%usecs%d{Z} [%process:%thread] %-5level %logger: %msg%n</pattern>
    </encoder>
  </appender>

  <!-- root logger has at least one appender that creates a file in the node logs/ folder. -->
  <root>
    <level value="info"/>
    <appender-ref ref="errlog"/>
    <appender-ref ref="warnlog"/>
    <appender-ref ref="infolog"/>
  </root>
</configuration>

Note that when a failure occurs and the StreamBase Runtime creates a snapshot archive of relevant files, log files stored outside the node will not be included. It will then be the responsibility of the system administrator to preserve these logs for troubleshooting.