Logs Are For Parsing

Tim Wilde shares an oft-forgotten truth:

How often have you found yourself contemplating some hair-brained regex scheme in order to extract an inkling of value from a string and wishing the data had just arrived in a well-structured package without all the textual fluff?

So why do we insist on writing prose in our logs? Take “Exception while processing order 1234 for customer abc123” for example. There are at least four important pieces of information drowning in that one sentence alone:

  1. An exception was raised!
  2. During order processing
  3. Order number 1234
  4. Customer abc123

Being an exception log message, it’s more than likely followed by a stack trace, too. And stack traces certainly don’t conform to carefully crafted log layout patterns.

Logging is something we tend to forget about and slap in at the last minute.  We also think about it from the viewpoint of a developer looking at a single error message.  Those are both mistakes that lead to a huge amount of extra work later.

Related Posts

SQL Server 2017 and Visual Studio 2017/2019 Installation Error

Hamish Watson walks us through an error which happens when you install SQL Server 2017 and Visual Studio 2019 in the “wrong” order: This blog post is about a situation that initially perplexed me – I was installing SQL Server 2017 onto a new DEMO machine – running Windows Server 2019. This install is one […]

Read More

dbatools and Error Handling

Shane O’Neill takes us through some of the error-handling dynamics available in dbatools: PowerShell errors normally contain useful information on what went wrong. With this information, the “what went wrong” can be fixed. That being said, if you are writing PowerShell scripts and not raising valid error messages then I highly advise you to go […]

Read More

Categories

February 2018
MTWTFSS
« Jan Mar »
 1234
567891011
12131415161718
19202122232425
262728