Skip to main content

Problem:

  • Product Name: VisiBroker for Java
  • Product Version: 8.5
  • Product Component: log4j Logging
  • Platform/OS Version: All

The log files created when using rolling appender are not getting appended when the VBJ process is restarted with the same logging configuration. Instead, the file will be truncated before being opened. Because of this issue, the logs from the previous runs are all deleted and cannot be used for any debugging purposes.

Resolution:

An internal RPI 595620 has been created for this problem.

If the application uses log4j.appender.* properties instead of vbroker.log.* properties, the behaviour is the same, as both go through the same logic.

A workaround for this issue is to create a log4j.xml, with the contents below, in the classpath of your application (or set the path in "log4j.configuration" property as given below). Then, VisiBroker will load the configured logger ("VBJ-Application", which is internally referenced) and appender from log4j.xml. the logs will then be appended after restarting the process.

The default appender (stdout) must also be disabled with the property "vbroker.log.default.appenders" to avoid the logs getting printed in stdout as well.

vbroker.log.default.appenders=test
vbroker.log.enable=true

vbroker.log.logLevel=debug

log4j.configuration=file:<path>/log4j.xml

log4j.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >

<log4j:configuration>

<appender name="VB-ALL" class="org.apache.log4j.RollingFileAppender">

  <param name="File" value="vbroker-debug.log"/>

  <param name="Append" value="true"/>       

  <param name="MaxBackupIndex" value="10"/>       

  <param name="MaxFileSize" value="2MB"/>       
 
<layout class="org.apache.log4j.PatternLayout">          

     <param name="ConversionPattern" value="%d{DATE} [%t] %5p %c - %m (%x)%n"/>           

  </layout>   

</appender>
  
<logger name="VBJ-Application" additivity="false">        

  <level value="DEBUG" />        

  <appender-ref ref="VB-ALL" />    

</logger>  

</log4j:configuration>

 


SI: 2619093 


#Security
#truncate
#VisiBroker
#rolling
#log4j