ENUM EventLogType changes should be reporting as breaking changes
See original GitHub issueDescription of bug
It’s not a bug. IMO a change in standard publicly exposed ENUM regularly used in module development should be reported as breaking change. Typically we target the minimum version of DNN we want to support and reference the appropriate assemblies in our project. A change between 9.2 and 9.6.2+ (probably more-so related to dependency injection change in… 9.5 or so?) introduced a change in the EventType for the logging controller.
Possibly discussion related to #4242
An often used log type would be ADMIN_ALERT
.
e.g. EventLogController.Instance.AddLog("hello", "world", portalSettings, userID, EventLogController.EventLogType.ADMIN_ALERT)
What I found is that after upgrading a DNN instance from 9.2.1 to 9.6.2 logging ceased. This is because the ADMIN_ALERT in 9.2.1 lined up in sequence (order) with APPLICATION_SHUTTING_DOWN in 9.6.2. and therefore was never logging.
Steps to reproduce
List the precise steps to reproduce the bug:
- Reference Dotnetnuke.dll v9.2.1 (or earlier)
- Attempt to write an ADMIN_ALERT to the event log in a site on v9.6.2+
Current behavior
Doesn’t log
Expected behavior
Should log an admin alert to the event viewer.
Affected version
9.6.2+
Workaround
For developers that do not want to create additional configurations/builds for their module, you can safely get the proper LogType by
var adminAlert = (EventLogController.EventLogType)Enum.Parse(typeof(EventLogController.EventLogType), "ADMIN_ALERT");
EventLogController.Instance.AddLog("hello", "world", portalSettings, userID, adminAlert)
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
For what it is worth this is something that has been worked on in the new
DotNetNuke.Abstractions
project. If you look at the newEventLogType
it is using numbered enumshttps://github.com/dnnsoftware/Dnn.Platform/blob/d5d6d2b1c9072e80228e1352de855ab6194aa128/DNN Platform/DotNetNuke.Abstractions/Logging/EventLogType.cs#L9-L19
This issue has been closed automatically due to inactivity (as mentioned 14 days ago). Feel free to re-open the issue if you believe it is still relevant.