red5 1.0.0 rc1:配置logback以记录org.red5.server.service.ServiceInvoker中的错误

时间:2010-05-27 13:26:06

标签: java red5 logback

这是我的logback配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextName>xpofacebook</contextName>
<appender name="ERROR"
class="ch.qos.logback.core.rolling.RollingFileAppender">
   <File>log/xpofacebook-error.log</File>
   <Append>true</Append>
   <BufferedIO>false</BufferedIO>
   <ImmediateFlush>true</ImmediateFlush>
   <layout class="ch.qos.logback.classic.PatternLayout">
       <Pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</Pattern>
   </layout>
   <rollingPolicy
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
       <FileNamePattern>log/error.log.%i.zip</FileNamePattern>
       <MinIndex>1</MinIndex>
       <MaxIndex>3</MaxIndex>
   </rollingPolicy>
   <triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
       <MaxFileSize>5MB</MaxFileSize>
   </triggeringPolicy>
   <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
       <level>WARN</level>
   </filter>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
   <File>log/xpofacebook-application.log</File>
   <Append>true</Append>
   <BufferedIO>false</BufferedIO>
   <ImmediateFlush>true</ImmediateFlush>
   <layout class="ch.qos.logback.classic.PatternLayout">
       <Pattern>%date{ISO8601} [%-5level] %logger{35} - %msg%n</Pattern>
   </layout>
   <rollingPolicy
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
       <FileNamePattern>log/xpofacebook-application.log.%i.zip</FileNamePattern>
       <MinIndex>1</MinIndex>
       <MaxIndex>3</MaxIndex>
   </rollingPolicy>
   <triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
       <MaxFileSize>5MB</MaxFileSize>
   </triggeringPolicy>
</appender>
<root>
   <level value="DEBUG" />
   <appender-ref ref="ERROR" />
   <appender-ref ref="FILE" />
</root>
</configuration>
到目前为止,它的效果很好 我需要将以下代码添加到我想要在其中记录消息的每个类中:

private static Logger log = Red5LoggerFactory.getLogger(ClassName.class, "xpofacebook");

我希望主日志文件xpofacebook-application.log记录我使用的类之外​​的消息。

如果Flex客户端连接到red5服务器并且尝试调用不存在的命令,则会显示以下错误消息:

[NioProcessor-1] org.red5.server.service.ServiceInvoker - Method
getLiveChallenges with parameters [] not found in
com.xpogames.xpofacebook.Application@55e03a61 

如何确保这些类型的错误消息也会包含在我的日志文件中?

1 个答案:

答案 0 :(得分:1)

这将改变Red5的核心日志记录功能。现在,应用程序外部的东西由不同的记录器控制,因为它们属于您上面的类加载器。在这里没有深入了解Java类加载器的乐趣,我只想说最终会出现修复或解决方法。