News for hackers. Stuff that matters.
Re:My Logging Best Practices (2020) by spaetzleesser on Tuesday October 05, 2021 @11:34AM (#28760867)
Agreed. Logging before gives you a lot of information to diagnose an issue. Logging just exceptions usually lacks a lot of necessary information
Re:My Logging Best Practices (2020) by goohle on Tuesday October 05, 2021 @12:25PM (#28761599)
Just print out all necessary information, in case of exception, and suggest a potential solution to the problem.
Re:My Logging Best Practices (2020) by slaymaker1907 on Tuesday October 05, 2021 @06:37PM (#28766614)
This does not work in practice a lot of the time. What if the problem was actually due to some other thread and said other thread didn't crash? If you only log after success/failure, you would have absolutely no idea why the program crashed. Oftentimes if the actual error were anticipated enough for good reporting, said error would not exist in the first place.