ACR Rules

  1. Home
  2. Docs
  3. ACR Rules
  4. Maintainability (28)
  5. Log message nodes should be consistent

Log message nodes should be consistent

Non-constant (dynamic/hard-coded) log nodes are more difficult to track in case of an error. The same module can use different log nodes due to typo’s, different developers, etc.

The recommendation is to use constants or enums. However, if a string literal is used then it should be consistently used in the app. In other words, if a string literal is only used in a single log message this message will be very hard to track in the log files.

@Example.ImportantLogNode
getKey(Example.LogNode_Enum.ImportantLogNode)

Noncompliant example:

Compliant example: