Red5: logging for external library
Given: Red5 0.8.RC3, application (.war) that uses a library (.jar).
The application uses slf4j for logging, all loggers are instantiated as follows:
private static Logger log = Red5LoggerFactory.getLogger(MyClass.class, "webcall"); //"webcall" is a context name
Configuration file for logging: logback-webcall.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextName>webcall</contextName>
<jmxConfigurator contextName="webcall" />
<appender name="WEBCALL" class="ch.qos.logback.core.FileAppender">
<File>/var/log/lx/webcall.log</File>
<Append>false</Append>
<Encoding>UTF-8</Encoding>
<BufferedIO>false</BufferedIO>
<ImmediateFlush>true</ImmediateFlush>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%date [%thread] %-5level %logger{35} - %msg%n
</Pattern>
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="WEBCALL" />
</root>
</configuration>
That one works for all loggers, that are instantiated as above. But in the library (which ha开发者_StackOverflow社区s no clue about Red5LoggerFactory and the contexts), the loggers are instantiated like this:
private static Logger log = LoggerFactory.getLogger(MyLibraryClass.class); //org.slf4j.LoggerFactory;
And they do not work.
Question: how to configure logging inside the library for Red5 server?
The solution was to configure logging in red5/conf/logback.xml
精彩评论