凡写日志的Windows应用程序 [英] Where to write log for Windows app

查看:155
本文介绍了凡写日志的Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了威盛的ClickOnce部署到Web服务器的.NET Windows应用程序。有大约100个​​用户在任何特定时间,全部位于中央。我使用log4net的应用程序内登录,但是我无法到达最好的地方,把日志。

I've got a .NET Windows application that's deployed via ClickOnce to a Web server. There are approximately 100 users at any given time, all centrally located. I'm using log4net to log within the application, but I'm having trouble arriving at the best place to put the log.

我试图让他们写入到一个共享的网络位置,但一些用户遇到较差的I / O与方法。我试图登录到用户的临时文件夹,但是这使得它更难检索日志。我没有尝试过的事件日志,因为我可能通过一些铁圈跳获得了工作,我不知道这是否是值得的。我从来没有尝试过的数据库的日志记录,但我一直认为,这将是相对缓慢的。

I've tried having them write to a shared network location, but some users have experienced poor I/O with that approach. I've tried logging to the user's temp folder, but that makes it harder to retrieve the logs. I haven't tried the event log because I will probably have to jump through some hoops to get that working, and I'm not sure if it's worth it. I've never tried database logging, but I've always assumed that it would be relatively slow.

没有任何人有部署在企业环境中的Windows应用程序日志的经验?在那里我可以把日志这样,这将是任何建议(1)快,(2)可靠;(3)是否可以访问?

Does anybody have experience with logging in a Windows application deployed in a corporate environment? Any suggestions on where I can put the log so that it will be (1) quick, (2) reliable, and (3) accessible?

推荐答案

与数据库记录的问题不在于速度:它的可靠性。你登录的时候出问题了,如果什么地方出了错已经无法访问DB的赔率是不是对你有利。

The problem with Database logging isn't the speed: it's the reliability. You log for when things go wrong, and if something's going wrong already the odds of an inaccessible DB aren't in your favor.

通常情况下,你要写入本地文本文件的的其他地方像一个网络共享或DB。如果您在IO /速度问题,你可以使用文本文件作为缓冲,写日志分批争资源。然后您定期刷新当地的备份的日志。

Generally, you want to write to a local text file and somewhere else like a network share or DB. If you're having IO/speed problems you can use the text file as a buffer and write logs to the contended resource in batches. Then you periodically flush the local 'backup' logs.

这篇关于凡写日志的Windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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