Print to DotNetNuke Event Log/Viewer

后端 未结 4 1735
盖世英雄少女心
盖世英雄少女心 2021-02-19 07:06

For debugging purposes, how can I print to the event log/viewer in DotNetNuke, using VB.NET or C#?

4条回答
  •  情话喂你
    2021-02-19 07:32

    Also, if you want to add more data to the log, you can use LogInfo class to add events to the log.

    Dim eventLog As EventLogController
    eventLog = New EventLogController()
    
    Dim logInfo As DotNetNuke.Services.Log.EventLog.LogInfo
    logInfo = New LogInfo()
    logInfo.LogUserID = UserId
    logInfo.LogPortalID = PortalSettings.PortalId
    logInfo.LogTypeKey = EventLogController.EventLogType.ADMIN_ALERT.ToString()
    logInfo.AddProperty("PropertyName1", propertyValue1)
    logInfo.AddProperty("PropertyName2", propertyValue2)
    
    eventLog.AddLog(logInfo)
    

提交回复
热议问题