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

发布于 2024-09-03 08:24:24 字数 2855 浏览 3 评论 0原文

这是我的 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 

How can i makesure that those type of error messages will be include in my log file as well ?

This is my logback configuration file:

<?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>

so far it works great
i need to add the following code to each class that i want to log messages in:

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

i want the main log file xpofacebook-application.log to log messages outside of the classes that i work with.

If a flex client is connected to the red5 server and is trying to invoke a command that does not exist, the following error message will be show:

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

How can i make sure that these type of error messages will be included in my log file as well?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人事已非 2024-09-10 08:24:24

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

This will take a change in the core logging functionality of Red5. Right now the stuff outside your application is controlled by a different logger because they fall within a classloader above yours. Without getting into the fun of Java classloaders here, I will simply say that a fix or workaround will eventually come.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文