在C#中的ASP.net中制作日志文件 [英] for making log file in ASP.net in C#
本文介绍了在C#中的ASP.net中制作日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要帮助来创建项目的日志文件.我不知道从哪里开始.我应该自己创建日志还是可以使用免费工具进行log.plz建议我并提供相关帮助.
在此先感谢您.
Hi all,
I need help to make a log file for project.I do not have any idea from where i have to start.should i make my own log or i can use free tool for log.plz suggest me and provide me related help.
Thanks in advance.
推荐答案
可以使用多种方法登录应用程序.
1. EventViewer
2.企业库-记录应用程序块
3.服务器上的简单文本文件
对于2:使用企业库进行日志记录 [
There are various ways to log in your application.
1. EventViewer
2. Enterprise Library - Logging Application Block
3. Simple text file on server
For 2: Get Logging with the Enterprise Library[^]
For 3:
public void WriteLog(string errorMessage)
{
string _LogFileName = System.Configuration.ConfigurationManager.AppSettings["logFileDestination"].ToString();
using (StreamWriter sw = File.AppendText(_LogFileName))
{
sw.WriteLine(errorMessage);
}
}
选项太多.
检查 ^ ].
There are so many options.
Check Google search link[^].
这篇关于在C#中的ASP.net中制作日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文