System.Diagnostics.Debug namespace vs Other logging solutions (log4net, MS Enterprise Library, etc.)

后端 未结 4 2094
轮回少年
轮回少年 2021-02-05 09:56

I\'m currently investigating various logging possibilities for .net projects and I can\'t decide between System.Diagnostics.Debug/Trace features and third party libraries like l

4条回答
  •  -上瘾入骨i
    2021-02-05 10:19

    Logging and tracing are different concerns. Logging pertains to operational feedback. Tracing (including that provided by the Debug methods) pertain to development and testing. Tracing code shouldn't be compiled into the release assemblies. The Trace and Debug classes achieve this with compiler annotations (ConditionalAttribute). Such code should be optimized to collect lots of data, not for performance. On the other hand, operational logging needs to be optimized for performance and for a wider variety of storage mechanisms as required by the sysadmin/operations team.

    So I recommend using both Trace/Debug for development as well as more robust logging packages for operations.

提交回复
热议问题