added the _firstInstance vairable, to force the log to clear only on apprestart. more code needed to make in process speciifc.