W3CLogging Library and Example
http://red5.electroteque.org/dev/demos/loggingTest.zip
loggingTest is a demo Red5 application (Red5Plugin project) to demonstrate server streaming logging into W3C log files and possibly socket and databases in the future.
The server logging is enabled by making the application adaptor extend org.red5.server.adapter.StatisticsApplicationAdaptor and then adding a log instance as a bean reference in the web.xml file.
The system works by using the scope name to determine which logger to use and will log to a directory of the same name as the scope name. The log files will append and rollover using a date filename pattern string.
The loggers can be preloaded on application startup if required also.
Configuration
Application adaptor must extend org.red5.server.adapter.StatisticsApplicationAdaptor which produces the log events for each stream event like so
import org.red5.server.adapter.StatisticsApplicationAdaptor;
public class Application extends StatisticsApplicationAdaptor {
....
The logger bean must be configured in red5-web.xml with a reference name streamStatisticsLog (cannot get it to reference the ILogger interface as yet.) like so
<bean id="streamStatisticsLog"
class="org.red5.server.logging.LoggerLoader">
<property name="logPath" value="${log.logPath}"/>
<property name="immediateFlush" value="${log.immediateFlush}"/>
<property name="bufferedIo" value="${log.bufferedIo}"/>
<property name="bufferSize" value="${log.bufferSize}"/>
<property name="events" value="${log.events}"/>
<property name="categories" value="${log.categories}"/>
</bean>
Configuration Options
- logPath - The setting to the logPath with string formatting for the scope name log/loggingTest/%s/ where %s is the scope name. - immediateFlush - Flush the logger immediately or buffer it. - bufferedIo - Buffer the logger, logs will buffer if set. (logs will be lost in buffer if server reboots, maybe need a shutdown method ?) - bufferSize - The ammount to buffer before flushing the logs to the log file. - events - Filter to these events only. Available events are connect,disconnect,server-start,server-stop,app-start,app-stop,\ app-connect,app-join,app-leave,app-disconnect,room-start,room-stop,\ room-connect,room-join,room-leave,room-disconnect,publish,unpublish,\ record,recordstop,play,stop,paquse,resume,seek - categories - Filter to these categories only. Available categories are session,stream,server,application.
