I'm working on a logging program, and I'd like to avoid processing the same Exception
object repeatedly when it is being logged repeatedly because it is percolating up through a nested call structure. So I'd like to be able to format the Exception
object once, and give the formatted version a unique "exception number" and then tag the Exception
object somehow so I can recognize it if it turns up again in a later log call.
The idea I've come up with is to misuse the HelpLink
field of the Exception
object. I'll set it to contain a string version of my "exception number". Then I can recognize the Exception
object if it shows up again momentarily in another log call.
But is this maybe a bad idea? Are there any gotchas involved that I haven't thought of? If so, does anyone have a better idea?
EDIT: To explain the situation a bit more, this logger will only be used on my own programs.