Possible to log normal messages but dump a debug log when errors occur?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Possible to log normal messages but dump a debug log when errors occur?

sofakng
I'm not sure if this is normal or not, but I'm thinking about logging "normal" messages to a log file, but if an exception (or other error) occurs, then I'd like to dump a debug log to a file.

The problem is that I don't want to constantly log debug information because there is a lot of it, so in the case of an exception/error I'm thinking about dumping the last 1000 or so debug messages or something like that.

Is this possible?

The memory target looks useful for this but I'm not sure how much extra memory it would take or if that is the best approach...