-1

I hear this term from time to time but haven't found any well defined precise technical definitions posted online. They all seem to use the notion as if the term scoped has been defined elsewhere.

I roughly understand it as logging which includes context identifiers that map to the stacktrace where the log records pair up in a balanced stack-like fashion--with enter and exit or start and finish entries as the stack drills down and unwinds across an application's execution.

Here's some fragments of the ideas

In C++, it’s useful to log not only when logging of a scope started, but also when it ended.

http://www.softwarepurist.com/blog/index.php/logging-in-c/

But scope as Microsoft has defined it in ILogger is actually to do with adding extra messaging onto a log entry. It’s somewhat metadata-ish, but it tends to lend itself more like a stacktrace from within a single method.

https://dotnetcoretutorials.com/2018/04/12/using-the-ilogger-beginscope-in-asp-net-core/

  • I'm pretty surprised at all the negative response to this, basically I was hoping someone would step up and volunteer to add to the corpus of online knowledge with a reasonable definition that serves to disambiguate things. Scope is a pretty overloaded term (variable, function, namespace, public private etc) so anything that could remove the fog from its usage here would help in general since there is no wikipedia entry or whatever for scopped logging per se. I figured why not allow SE to be the home for something tending toward a formal definition so I could link to it in some.... – jxramos Aug 4 '20 at 17:34
  • ...documentation for those new to the field of software engineering (especially recent graduates) who may be unfamiliar with that subject entirely. Compact phrases that tackle somewhat busy ideas are always valuable I felt. – jxramos Aug 4 '20 at 17:36
  • 1
    When you say "... as if the term scoped has been defined elsewhere." it makes it sound like you don't know what it means and didn't try to find out. The truth is that it has been defined elsewhere, but it has too many definitions, and they vary by language and context. You may have intended to leave the scope (sorry) of the question wide open, but it could easily be interpreted as lack of research effort. – Useless Aug 5 '20 at 15:42
2

Yep. Scope is simply a spatial-temporal region.

Logging tools will provide different mechanisms for tracking it, but it boils down to: Where are you?

In C/C++, the language does not provide stack traces, these have to be self-provided which means that logging entry and exit from a given scope is a smart idea for knowing where you are. Not every scope needs to be logged, but there are obvious ones that make sense such as when entering exiting a business rule command, or a piece of complex logic that you are probing.

In C# stack-traces are language provided, so these logging frameworks take for granted (and usual auto provide) stack traces. Instead these logging frameworks try to suggest using a more meta-physical where, like 'in payments processing step b'.

Either way scope is pretty amorphic, it depends very much on context, and very much on who is asking the question.

  • Thanks for jumping in, yah, it's that "scope is amorphic" bit that I felt could be benefited by at least enumerating the most common attachments for scope. In my experience it's basically the function scope of big / critical logic chunks that warrant a log trace. Same with construction and destruction of long lived important objects and what not. There's nothing formulaic to it for sure about what to target traces with. – jxramos Aug 4 '20 at 18:37
  • @jxramos yeah, in my experience scope can include the target servers, the build process, test requirements, complete module, etc... What is common depends specifically on what concern you happen to be handling. From a functional perspective it is a tight piece of logic, or a function. But if this logging happens to be for operations or even support, then the scope is a completely different beast. – Kain0_0 Aug 4 '20 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.