Specification icon indicating copy to clipboard operation
Specification copied to clipboard

Logging in the Package

Open ardalis opened this issue 1 year ago • 4 comments

Based on these docs: https://learn.microsoft.com/en-us/dotnet/core/extensions/logging-library-authors

Is there any logging that would be worthwhile for users of the Specification package (or its Repository base types)?

ardalis avatar Aug 16 '23 12:08 ardalis

Not really. The EF will emit logs anyway. Since we're using consumers' DbContext, the logging is included based on their respective configuration. Other than that, I can't think of anything worthwhile.

fiseni avatar Aug 16 '23 12:08 fiseni

I sometimes create logging decorators for repos that include timers so I can determine which queries are slow - might that be useful? EF logging doesn't provide this in a nice manner.

ardalis avatar Aug 16 '23 13:08 ardalis

What would the logging content look like in that case? Also, will you depend on DateTime?

fiseni avatar Aug 16 '23 13:08 fiseni

Now that the OTEL is becoming a standard, perhaps we should add distributed tracing instrumentation using Activity. That makes more sense than logging. Also, we may publish metrics, that might be useful for perf analysis. We need to analyze and invest in this.

fiseni avatar Nov 21 '23 18:11 fiseni