cf.net异常和其他日志记录 [英] cf.net exception and other logging

查看:75
本文介绍了cf.net异常和其他日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向WM6 Pro上运行的cf.net应用程序添加一些日志记录功能.我正在查看日志记录异常和一些更敏感的代码部分.我想既将日志存储在本地(即存储在设备上),又要可靠地将其上传到服务器(它们需要排队,我的应用有时会连接).

I want to add some logging capability to a cf.net application running on WM6 Pro. I'm looking at logging exceptions and some of the more sensitive sections of code. I would like to have logs stored both locally (i.e. on the device) and also have them reliably uploaded to a server as well (they will need to be queued, my app is occasionally connected).

有人知道log4net是否可行,还是我必须编写自己的日志记录系统?有人有指针吗?

Does anyone know if this possible with log4net or will I have to write my own logging system? Does anyone have any pointers?

推荐答案

如果为此使用log4net,请不要使用UDP附加程序选项登录到远程服务器.如果WM设备通过ActiveSync连接到PC并通过PC访问网络,则尝试使用UDP将使ActiveSync崩溃,这需要重新启动PC并进行WM设备的软复位.正因为如此,我的演示发生了严重错误(我们损失了一笔巨额合同).

If you use log4net for this, DO NOT use the UDP appender option to log to a remote server. If the WM device is connected to a PC via ActiveSync and accessing the net through the PC, attempting to use UDP will crash ActiveSync in a way that requires a reboot of the PC and a soft reset of the WM device. I had a demo go horribly wrong because of this (we lost a huge contract).

log4net在其他环境中可能很棒,但是我发现它是PITA,不值得在Windows Mobile中解决.最好编写自己的简单Logger类,该类使用TextWriter将信息转储到文本文件中(用于本地日志记录)或在远程服务器上调用webservice函数.您完全可以控制在何处写入什么内容,并且不需要阅读任何电锯废话就可以阅读日志.

log4net may be great in other environments, but I've found it to be a PITA and not worth the trouble in Windows Mobile. You're better off writing your own simple Logger class that uses a TextWriter to dump info into a text file (for local logging) or calls a webservice function on a remote server. You have total control over what gets written where, and you don't need any Chainsaw nonsense just to read your logs.

这篇关于cf.net异常和其他日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆