Learning Library

← Back to Library

Logging Beats Remote Debugging

Key Points

  • The speaker’s habit of using source‑level IDE debuggers for remote server code proved inefficient, revealing that PC‑style debugging doesn’t scale to production environments.
  • A veteran server developer advised replacing interactive debugging with comprehensive logging, emphasizing that “logging is king” for both development and production troubleshooting.
  • Effective logs must be high‑quality, capturing full parameter values, state information, and detailed exception data to enable rapid issue isolation without stepping through code.
  • Incorporating assert statements to validate expected input and output states further enhances debuggability, leading to the conclusion that source‑level debugging should be abandoned in favor of well‑instrumented, log‑driven code.

Full Transcript

# Logging Beats Remote Debugging **Source:** [https://www.youtube.com/watch?v=-lqMeBPtbKc](https://www.youtube.com/watch?v=-lqMeBPtbKc) **Duration:** 00:03:32 ## Summary - The speaker’s habit of using source‑level IDE debuggers for remote server code proved inefficient, revealing that PC‑style debugging doesn’t scale to production environments. - A veteran server developer advised replacing interactive debugging with comprehensive logging, emphasizing that “logging is king” for both development and production troubleshooting. - Effective logs must be high‑quality, capturing full parameter values, state information, and detailed exception data to enable rapid issue isolation without stepping through code. - Incorporating assert statements to validate expected input and output states further enhances debuggability, leading to the conclusion that source‑level debugging should be abandoned in favor of well‑instrumented, log‑driven code. ## Sections - [00:00:00](https://www.youtube.com/watch?v=-lqMeBPtbKc&t=0s) **From IDE Debugging to Logging** - After moving from PC to server-side development, the speaker discovered that remote source-level debugging is impractical and that relying on robust logging is essential for diagnosing production issues. ## Full Transcript
0:00welcome to Lessons Learned a series 0:02where we share our biggest mistakes so 0:04you don't make the same ones today's 0:05lessons come from my time transitioning 0:08from PC development to server side 0:10development 0:12so I was asked to debug a problem on 0:15server side 0:16after having done many years doing PC 0:19development 0:22and in PC development when I would do 0:24debugging I would typically connect 0:26directly to 0:28the local PC and use an IDE Source level 0:32debugger 0:33and when I started doing 0:36server-side programming I carried that 0:39same habit across where I would connect 0:42to a remote server with a debugger 0:45Source level and try and solve a problem 0:49but it caused me a lot of grief it 0:51turned out it was really ineffective and 0:54ultimately 0:55it was my debug approach that needed to 0:58change 0:59and what convinced me to do that is one 1:02of the developers who'd been doing 1:03server side programming for most of his 1:06career pulled me aside and said your 1:08approach simply doesn't work it doesn't 1:10scale and it's not very realistic for a 1:13production environment instead you need 1:15to do logging 1:17yeah 1:19in fact he argued logging is keying is 1:23King you simply need to always use that 1:25and don't even waste your time with 1:27Source level debuggers now first I'm 1:29thinking that's ridiculous I mean that's 1:31the whole purpose of having an IDE is 1:34being able to save time being able to 1:36make a quick change and see the result 1:38Etc 1:39but he argued that having one way of 1:43solving problems for development and 1:45another way for production is really not 1:48very efficient you should use the same 1:50skills the same tools all the time 1:54and then he argued that for code to be 1:59debuggable it must have several things 2:05of course what I just mentioned it 2:07should have logs 2:09and those logs need to be really high 2:11quality logs not just an error occurred 2:14but it needs to include all the 2:15parameters and all the state would be 2:17necessary to track down the problem and 2:20especially for exceptions 2:24for exception code you should throw up 2:27not just the error but also what was the 2:30state of all the parameters that were 2:32associated with that 2:33and along the same line 2:38you want to have assert statements in 2:41the beginning and end of your code which 2:44asserts expected States and parameters 2:47so you can debug that much more quickly 2:49that way you can pull the logs and 2:52examine the logs and not spend time 2:54transitioning between an IDE and code 2:58and logs for a production environment 3:01in fact he would argue you should just 3:04abandon Source level debug 3:09it took me a long time to be convinced 3:11that was in fact true but over time I 3:14learned that having quality logs and 3:16making code that is made to be debugged 3:19is really the key to being a developer 3:21that can solve problems more quickly and 3:24have developed skills that apply not 3:26just to development but also for 3:28diagnosing problem in production