c# - 打印到 DotNetNuke 事件日志/查看器

标签 c# vb.net dotnetnuke

出于调试目的,我如何使用 VB.NET 或 C# 打印到 DotNetNuke 中的事件日志/查看器?

最佳答案

来自 http://www.ventrian.com/Resources/Articles/tabid/213/articleType/ArticleView/articleId/330/Logging-to-the-EventLog.aspx (只是文章的相关部分):

Using the event log in code is quite simple, the code is as follows:-

First, create an instance of the EventLogViewer...

Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController

Next, log the event you wish to trap...

objEventLog.AddLog("Sample Message",
    "Something Interesting Happened!",
    PortalSettings,
    -1,
    DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT)

Now, when this code is run, the event log entry should appear in admin -> log viewer! You can customise these type of events, whether they be admin, host, item updated, etc.

关于c# - 打印到 DotNetNuke 事件日志/查看器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2042357/

相关文章:

c# - 限制在 C# 中使用结构

c# - ASP.NET_SessionId cookie 未定义

c# - 如果 "using"有异常会自动关闭

c# - 日期时间格式问题

.net - 从名称实例化泛型的最佳方法是什么?

asp.net - 使用 DotNetNuke 的新 ASP.NET 网站

css - DNN 自定义皮肤未加载正确的 CSS

c# - 如何在 ASP.NET MVC 中选择数据访问方法?

javascript - 使用 javascript 获取 DotNetNuke 中的当前用户名

c# - 提取对象类型以用作通用 <T>