The Problem With Logging

I have started using Aspects to weave in the log statements in the code at run time. The advantage I get is I can weave at class or package level and it allows me to switch off the logging if not required. The amount of code to be written also gets reduced by 20% leading to smaller code base and improved productivity.

There is no substitute for step debugging and gleaning the code.

I recently contracted a job now that it is done. The companies on boarding wants me to write all of the tools for them. That will make their life’s as the tech support easier. That’s all fine and dandy, but me building them a bug tracking, log error reporting system, was not what I was contracted to do.

And to top that off, they want me to write so many comments, that my code will look like the incredible Hulk.

@Gilbert If a tree falls in a forest, it was probably caused by logging X)

couldn’t help myself.

1 Like

I completely agree with this. people get very carried away with excessive logging. Logging has to be meaningful, but to be able to create meaningful logs you need to have people who understand the meaning of logging. Excessive logging is an expensive problem, and in even in case of critical errors there is still excessive logging: You don’t need to see a 100 line stack dump when the error can be told in a single line of text. The other 99 lines are not only completely unnecessary but they’re cluttering up the screen. Log smart, log concise, log what you need to know to help the program run efficiently, not what you want know to satisfy some morbid curiosity about how the program is being used. The latter should never be the responsibility of logging. There are other systems much better suited to user activity tracking that can get a lot more detailed use-case information than logging can ever hope to accomplish.

1 Like