|
利用AnyChat Server SDK开发的业务服务器通常是在后台运行,如果上层业务代码存在缺陷,则不太方便调试。通常来说,AnyChat Server SDK与上层业务的交互有两部分,其一是API调用,其二是异步事件的回调。之前的版本只在日志信息中记录API调用,而没有记录异步事件的回调。
为方便用户调试业务服务器,AnyChat开发团队在新版本(AnyChat r4475)中增加了异步事件回调的日志跟踪功能,可通过业务服务器配置文件(AnyChatServerSDK.ini)进行开启:- [Base Settings]
- DebugMode=0
- ServerIpAddr=127.0.0.1
- [Debug Settings]
- OutputCallBackInvoke=0
复制代码 当DebugMode(默认为0,关闭)设置为1后,将在日志文件中输出API调用的信息;
当OutputCallBackInvoke(默认为0,关闭)设置为1后,将在日志文件中输出异步事件的信息,包含相关的参数信息,如下所示:- [2015-01-15 15:27:47(763)] AnyChat Server SDK Init,V5.2, Build Time:Jan 15 2015 15:27:38
- [2015-01-15 15:27:47(779)] Invoke BRAS_InitSDK(0x0)
- [2015-01-15 15:27:47(779)] Ready to connect anychatcoreserver 127.0.0.1....
- [2015-01-15 15:27:47(857)] Success connected to anychatcoreserver...
- [2015-01-15 15:27:47(857)] Begin OnServerAppMessageExCallBack(msg:10, errorcode:0)
- [2015-01-15 15:27:47(857)] End OnServerAppMessageExCallBack, Elapse:0 ms
- [2015-01-15 15:27:59(513)] Begin OnVerifyUserCallBack(name:AnyChat4)
- [2015-01-15 15:27:59(513)] End OnVerifyUserCallBack, Elapse:0 ms
- [2015-01-15 15:27:59(560)] Begin OnUserLoginActionCallBack(userid:1, name:AnyChat4)
- [2015-01-15 15:27:59(560)] End OnUserLoginActionCallBack, Elapse:0 ms
- [2015-01-15 15:28:00(558)] Begin OnPrepareEnterRoomCallBack(userid:1, roomid:1)
- [2015-01-15 15:28:00(558)] End OnPrepareEnterRoomCallBack, Elapse:0 ms
- [2015-01-15 15:28:00(636)] Begin OnUserEnterRoomActionCallBack(userid:1, roomid:1)
- [2015-01-15 15:28:00(652)] End OnUserEnterRoomActionCallBack, Elapse:15 ms
- [2015-01-15 15:28:02(306)] Begin OnUserLeaveRoomActionCallBack(userid:1, roomid:1)
- [2015-01-15 15:28:02(310)] End OnUserLeaveRoomActionCallBack, Elapse:0 ms
- [2015-01-15 15:28:04(685)] Begin OnUserLogoutActionExCallBack(userid:1, errorcode:0)
- [2015-01-15 15:28:04(685)] End OnUserLogoutActionExCallBack, Elapse:0 ms
- [2015-01-15 15:43:59(665)] Invoke BRAS_Release
复制代码 当业务服务器出现问题之后,上层应用还可以通过“开放上层应用日志写入能力”所提供的API接口向日志文件中写入业务层自己的日志信息,进一步排查问题原因。 |
|