-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Use names in EventIds for logging #6818
Comments
Numeric event IDs are somewhat meaningless when looking through logs, this would be a great improvement. |
@glennc, is this something we should prioritize for 2.2 milestone? |
Changing existing eventIds would be a breaking change for customers, suddenly things parsing logs looking for numbers would need to change. Right? Given that I don't think we could do something meaningful here in 2.2 at all, and I don't know if the improvement would ever be worth the potential pain. But we could have the discussion for new things we log, if we do that it should be all-or-nothing in that all components get strings instead of ints as we go forward. |
No, my understanding is that it is not breaking. It somewhat depends on the logging provider but Serilog, for example, tracks the Event ID and Event Name as separate data fields. So as long as we don't change the numbers, any queries that were based on "EventID = 123" should continue to work, we would just be additionally enabling queries based on "EventName = zoinks" |
/cc @glennc |
This is understood now. It's about logging additional data (the event name). Punting to a future release as we won't have time to handle this now. |
When logging, we use
int
s for theeventId
parameter, but theEventId
type that is used can actually also support holding a name. Names are easier to query and inspect in structure log storage. So, as an example, aLoggerMessage.Define
should change to something like this:(Event ID names don't need a prefix because
EventId
is only unique within a Logger, so there's no need to prefix it).The text was updated successfully, but these errors were encountered: