|
We had to log every first and last line of a function, including all input and output parameters.
We had two or three 10 MB files per day, so not a lot.
And still it was pretty much impossible to find anything of value.
Notice that if we had 10 files and two to three files a day, we couldn't search back farther than about 3 to 4 days ago.
Always fun when the software went into a loop, that was usually good for 7 files in a few minutes...
It was really just logging because "we have to log something."
At least we had a separate error log, so that worked (most of the time).
Before that I worked at a company who logged everything to the database.
We had a separate log for exceptions, functional events, and tracing.
We could filter, group, etc. Much easier to find and fix bugs as they happen or long after that.
|
|
|
|
|
"Entering xyz" is what we do too, at least for methods (in java, we do not log getter/setter).
This is the verbose level, retained for about 2 hours in the log.
Enough time for admin team, if the monitoring system raises an alert to snapshot the log and find the codepath, that is active.
Loggin method entries is nothing unusual as far as I can tell.
I personally don't see much sense in logging the exits, except for functions that return a value, but even in those cases we log the return value from the calling method, not inside the executing method, for a simple reason: There are MANY threads active, even with the threadId in the log, the log is easier to follow with lines like "(Methodname) received [HANDLE_INVALID] from [getWindowHandle]. Creating new window." than from an anonymous "Returning [HANDLE_INVALID]" out of a method that runs 50 times a second." (Just an example).
If you can't find anything in those logs, think about their structure.
In our production systems we have no other chance than those logs to find out whats going on, with 10k users online. The log density is extremely high.
But I can understand that writing logs can get boring very easily very fast. But we see it as part of our code quality. The structure of the log is extremely important for monitoring, so we have to keep the patterns straight with not much room for grammar. Some keywords, some values - everything for the monitor
|
|
|
|