在项目中导入 slf4j-api-1.5.6.jar

首先在项目 src/ 中加入 logback-项目名称.xml 配置文件

配置文件如下:
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<configuration>

<contextName>hello</contextName>

<jmxConfigurator contextName=”hello” />

<appender name=”HELLO” class=”ch.qos.logback.core.FileAppender”>
<File>logs/hello.log</File>
<Append>true</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>
<appender-ref ref=”HELLO” />
</root>
<logger name=”com.D5power”>
<level value=”DEBUG”/>
</logger>
<logger name=”org.apache.derby”>
<level value=”DEBUG”/>
</logger>
</configuration>

导入使用的类;

import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

在类开始的地方加入

private Logger log = Red5LoggerFactory.getLogger(Application.class,”项目名称”);
首先需要修改web.xml文件,添加日志侦听和过滤设置,如下:
<listener>
<listener-class>org.red5.logging.ContextLoggingListener</listener-class>
</listener>
<filter>
<filter-name>LoggerContextFilter</filter-name>
<filter-class>org.red5.logging.LoggerContextFilter</filter-class>

</filter>

<filter-mapping>
<filter-name>LoggerContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

调用的方法:

public void trace(String message);
public void debug(String message);
public void info(String message);
public void warn(String message);
public void error(String message);

2009-6-2-18-09-50

从原来 Red5 0.62版本的程序直接升级到 08RC2出现的问题,多个应用只有这么一个出问题,这个应用前期不是我写的所以读代码很费劲,很多匪夷所思的写法,可能是我的理解能力也是在有限,运行后出现图示的错误,从报错的顺序看视乎是内部错误,但是后来仔细查代码发现一处在关闭Room的时候特意去删除了保存在 setAttribute中的数据。道理来说Room销毁时这里的数据会自动消失,修改这个段代码后问题暂时解决。

目前还有一个错误正在查:

Closing RTMPMinaConnection from 192.168.1.111 : 1090 to 192.168.1.111 (in: 34
57 out 3212 ), with id 8592017 due to long handshake

查到了几个解决方法明天上班试试:

1.把示例中的配置文件复制到此目录

2.下载并查看Red5日志

3.查看5080端口是否被占用

功夫不负有心人,Google查技术问题还是有一套啊(毕竟很多技术文档都是英文)!官方的JARA有这样一篇文章:

http://jira.red5.org/browse/APPSERVER-168

用户提出的问题和我差不多:

I run an chat application under 0.62,but the server crashed after a period of time.
Than I restart red5 server and it works,crashed again later.

Here is the output:
[WARN] 162073478 DefaultQuartzScheduler_Worker-8:( RTMPConnection.execute ) Closing RTMPMinaConnection from 61.183.129.30:2573 to www.flashpioneer.com (in: 3577, out: 4749) due to too much inactivity (1183441373078).

Is the server-side script craused?

为什么会出现这个问题:

Server works, and after some period of time stop responding. On first run, after server stopped responding, it continued to consume CPU time, reducing load linearly (number in ‘top’ CPU column been reducing for 0.4 each minute…).

如何解决:

if you do wait for onResult before you call a new function on the server (by setting a variable to “busy” and test that variable before you call the server-sided function) you can call thousands of functions without a problem.

不过这个Error提交的日期很早了。当时是Red5 0.6.3 不确定是否在0.8 RC2 有所解决?

Red5的邮件列表中有人提到

Afaik it happens under stressful situations. If you DO NOT wait for a result
from a call to the server and keep on sending data then this warning (and
disconnection of your client) will happen in a few seconds later.

When doing stresstests I received these errors in matters of seconds when
trying to kill my server by sending 100+ functioncalls per second.

If for some reason Red5 is busy, for say 5 seconds, you won’t hammer it and
your connection cannot break because you are polite and wait for an answer
first.

他的解决方案:

1. create a global variable e.g. “sState”
2. check if ‘’sState” is “busy” BEFORE you make a call to the server
3. set “sState’” to “busy”
4. make the call to the server
5. set “sState” to “available” when you have received a result (with
.onResult)

Next step ; let your application wait for a free slot instead of hammering
it:

6. make a queuing system where you stack outgoing function calls (storing
the name of the function and the parameters you want to send to Red5 in an
array)
7. check the queue using a onEnterFrame (or similar) method
8. test [2]
9. call the function on Red5
10. remove the item from the queue
11. Rinse and Repeat.

我觉得不是十分靠谱,还不如所有的conn.call()都加上Response

三里屯滋味

17 5
2009

三里屯明明是个村子的名字,在北京却被挂上了时尚和潮流的头衔,虽然个人不是潮流人物,但也想去窥其究竟。

三里屯滋味

三里屯滋味

Read the rest of this entry »

页面: 1 2 3 4

发现一篇牛文,还没有试验过,不过如果可行,可以解决我们很多问题。对于AIR的普及也有一定好处。
不用安装 air runtime的解决方案。
也就是之前的 直接 air2exe的方案,,也是是 shu package打包的方法

你要下载adobe air sdk.

解压 找到 bin目录

写个命令行。
adl yourapp\application.xml

application.xml就是 你的程序.air 解压出来的。

我的程序名称是 AirPdfReader3.air 比如我解压 air后的目录是。

AirPdfReader3\META-INF\AIR\
在这里找到application.xml

把他复制到

AirPdfReader3\
程序的根目录

然后直接点击 那个命令行就ok.

原文地址:http://space.flash8.net/space/?uid-214621-action-viewspace-itemid-441425

悟空随拍

24 4
2009
top