发布到Windows日志 [英] Posting to Windows Log

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

问题描述

因此,所有网站都明确要求您创建源,但是由于我有权限错误,所有这些都无法正常工作.现在,出于我的需要,我没有兴趣解决该权限错误,这就是原因.

So all the website have you explictly creating a source, all of which do not work because I have permission errors. Now for my need I have no intrest in solving that permission error and here is why.

昨晚,我发现了一篇包含三行代码的文章,该文章使我能够以我的名字作为来源写到Windows日志中.这是我在互联网上找到的唯一对我有用的(简单)代码.问题是,我丢失了该代码和网站. 任何人都知道如何聪明地将临时错误发布到Windows日志中,而不必解决源属性的安全性并且无需编写大量代码.

Last night I found a post that was three lines of code that allowed me to write to the windows log with my name as a source. it was the ONLY (simple) code on the internet I was able to find that worked for me. Problem is, I have lost that code and the website. Anyone know how to be clever in posting temporary errors to the windows log without having to address the security of source property and without writing miles of code.

我们已经有一个日志记录系统,它只是无法正常工作,但我需要查看现在正在发生的错误,因此这将是非常临时的.

we have a logging system already in place its just not working but I need to see the errors that are happening now so this would be stricktly temp.

推荐答案

我假设是因为您提到网站"这是一个ASP.Net Web应用程序?您也没有提到使用的语言,这可能很重要,因为VisualBasic命名空间可能包含通常不会使用的方便的帮助器. 在C#中可用.

I assume since you mention "website" that this is an ASP.Net Web application?  You also didn't mention the language used and that could be important because the VisualBasic namespace may include handy helpers that wouldn't normally be available in C#.

始终最好将ASP.Net问题发布到 http://forums.asp.net

It's always best to post ASP.Net questions to http://forums.asp.net

也就是说,在VB中,它可能很简单:

So, that said, In VB it could be as simple as:

Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try

        Catch ex As Exception
            My.Application.Log.WriteException(ex)
        End Try
    End Sub

End Class



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

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