出于调试目的,我如何使用 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/