Configure VHost and application context logging for Wowza Streaming Engine

Wowza Streaming Engine™ media server software uses the Apache Log4j 2 Java logging framework for logging. This article describes how to use the context logging feature in Log4j to assign different loggers to different levels or contexts. 

Note: The instructions in this article apply to Wowza Streaming Engine 4.8.8.01 and later. For version 4.8.5 and earlier, see Configure VHost and application context logging for Wowza Streaming Engine (legacy).

About Log4j 2 context logging


Wowza Streaming Engine 4.8.8.01 and later uses the Routing appender of the Log4J 2 framework to enable context-based logging. This means you can enable logging on a per-virtual host, per-application, or per-application instance basis. This can be useful if you want to offer Wowza Streaming Engine as a shared service to several customers. The Routing appender provides a method to dynamically configure appenders based on field values stored in a ThreadContext map. The following ThreadContext map values are used to control per-vhost and per-application logging:

Field name Description
x-vhost-context The virtual host name, if specified.
x-app-context The application name in the format [vhost-name].[application-name], if specified.
x-appinst-context The application instance name in the format [vhost-name].[application-name].[appinstance-name], if specified.

When enabled in log4j2-config.xml, the logging infrastructure creates appenders on the fly for unique values of x-vhost-context, x-app-context and x-appinst-context.

Enable logging per virtual host


  1. Navigate to [install-dir]/conf/ and open log4j2-config.xml in a text editor.
  2. Uncomment the following two appenders in the <Loggers>/<Root> block:
<AppenderRef ref="vhostAccess" level="info"/>
<AppenderRef ref="vhostError" level="warn"/>

Enable logging per application


  1. Navigate to [install-dir]/conf/ and open log4j2-config.xml in a text editor.
  2. Uncomment the following two appenders in the <Loggers>/<Root> block:
<AppenderRef ref="applicationAccess" level="info"/>
<AppenderRef ref="applicationError" level="warn"/>

Enable logging per application instance


  1. Navigate to [install-dir]/conf/ and open log4j2-config.xml in a text editor.
  2. Uncomment the following two appenders in the <Loggers>/<Root> block:
<AppenderRef ref="applicationInstanceAccess" level="info"/>
<AppenderRef ref="applicationInstanceError" level="warn"/>