Print to DotNetNuke Event Log/Viewer

后端 未结 4 1723
盖世英雄少女心
盖世英雄少女心 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:40

    This is the C# version

    using DotNetNuke.Common.Utilities;
    using DotNetNuke.Services.Log.EventLog;
    
    EventLogController eventLog = new EventLogController();
    DotNetNuke.Services.Log.EventLog.LogInfo logInfo = new LogInfo();
    logInfo.LogUserID = UserId;
    logInfo.LogPortalID = PortalSettings.PortalId;
    logInfo.LogTypeKey=EventLogController.EventLogType.ADMIN_ALERT.ToString();
    logInfo.AddProperty("KeyWord=", txtSearch.Text.Trim());
    logInfo.AddProperty("KeyWordLike=", myParams);
    eventLog.AddLog(logInfo);
    

提交回复
热议问题