Problem:

When debug is enabled for the above product, the log entries are duplicated and has a different format from the original.

Resolution:

VisiBroker for Java uses log4j for the internal logging. The VisiBroker property vbroker.log.default.appenders defines the appenders to be used for logging.

The log4j package will search in the start folder of an application for configuration files, either log4j.xml or log4j.properties. In such a configuration file additional appenders may be defined. If such an appender writes into the same destination as one of the appenders in vbroker.log.default.appenders, each log entry will be duplicated.

 

The issue can be reproduced by following the steps below:

1.  Use one of the 
VisiBroker for Java examples and add the log4j.xml file attached in this article into the main directory.

2. 
Start the example with the additional property vbroker.log.enable=true. The default value for vbroker.log.default.appenders is stdout, hence all log outputs will be written to console.

3.   T
he log4j.xml file configures a console appender with the name “stdout”. The appender is added to the root element, from which all loggers are derived. It means that any log message sent to a log4j logger, will additionally be handled by the root element, and hence be written to console. Since the logger in VisiBroker is also configured to write to console, all log messages will appear duplicated.

The issue can be resolved by removing the log4j.xml or log4j.properties from the application.