AlgoTraderAlgoTrader Documentation

Chapter 15. Logging

15.1. Custom UI Log Event Appender

This is a special customized appender which allows to send log events to the UI. The log events are sent via JMS/STOMP and log levels and loggers are configurable. For example you could define a particular logger (e.g. some specific class) or use the Root logger configured for the desired log level, e.g. INFO or WARN. In order to have multiple loggers with multiple log levels, separate appenders must be created each with it's own filter. The sample configuration below will create two UI appenders - one with level WARN (and above), another with INFO. Loggers defined in "Loggers" section reference these appenders in such a way that INFO log entries from PortfolioServiceImpl as well as all the entries with level WARN and above will be sent to the UI

Log entries are wrapped inside JMS message and get propagated via WebSocket STOMP protocol to the UI. In order to consume the log message the client will have to be subscribed to specific JMS topic ("/topic/log-event."). See StompAPIUtils.js in the HTML client for the subscription logic example.

    <LogEvent name="LogEventWARN">
        <ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
    <LogEvent name="LogEventINFO">
        <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
    <Root level="debug">
        <AppenderRef ref="LogEventWARN"/>
    <Logger name="ch.algotrader.service.PortfolioServiceImpl">
        <AppenderRef ref="LogEventINFO" />