I am working on a framework for several applications that implement multi-level logging. It is mainly used in applications used internally to verify communication with other devices, but is also used in some applications that we will distribute.
Is there a way to catch an uncaught exception and quickly execute code to save the exception in a log file? At the moment, the log class simply writes to the file so often, alternating between two files in case of write failure, etc. This works well, but it would be great if he saw that an unhandled exception was thrown, write any unwritten logging to the file, notice that the exception occurred, and write down its details, and then allow the application to crash.
If there is a way to catch unhandled exceptions in the application, I would think it would be something like:
appDidReceiveUnhandledException:(NSException *)exception { //write log to disk //append exception info to log file //rethrow exception }
If someone can give me an idea or suggestions as to whether this is possible, it would be very helpful.
mbuc91
source share