[GNC] Using logs for recovery

davidcousens49 at gmail.com davidcousens49 at gmail.com
Tue Jan 18 16:00:59 EST 2022


Dan

GnuCash will create a log file and a backup file copy  each time it exits and
depending on you preference settings will usually keep a fixed number of them in
the same directory as the mainfile. It is good practice to keep your mainfile in
its own directory for this reason. The trick is to pick the logfile with a date-
timestamp just before the session in which you crashed. There will also be a
similar number of timestamped backup files.

If your main file (the one with no timestamp) won't open after a crash, the best
procedure is to  rename the current mainfile by adding a ".old" or similar
extension appended then copy the backup file with the most recent timestamp to
the main file <filename>.gnucash. Run GnuCash opening the renamed backup file,
import any log files in sequence with a timestamp more recent than the backup
file you renamed as the main file. That should restore your file to the point
just before the crash. If that succeeds then you can delete the copy of the main
file you renamed to ".old"


If this still causes a crash repeat the sequence but edit the most recent log
file in a text editor before importing it and remove the last transaction which
likely caused the crash. You will then have to reenter that transaction when
GnuCash is up and running.

Note  In the above only a copy of the most recent backup is renamed to the
mainfile and not the backup itself. This maintains the integrity of the file
backups should anything go wrong in the subsequent import which allows you to
repeat the procedure until you manage to correct the problem.

David Cousens

On Tue, 2022-01-18 at 09:10 -0800, Dan wrote:
> Greetings,
> 
> Several times I have tried to use logs to recover after a crash and never
> seem to be able to make them work.  (Please note that I am "intermediate
> level" with GNUcash, and have very limited programming experience.)
> After navigating to:  File → Import → Replay GnuCash .log file, I am faced
> with many .log files following the most recently saved  .gnucash file.
> None of the .log files I replayed seem to do anything.
> My next step is to set up a test company and wreak havoc on the files
> intentionally, and also recover correctly. Below are some questions I hope
> will save me some time.
> Thank you for your consideration. This site is very helpful.
> 
> 
> My questions are:
> 
> Am I missing a crucial step here?
> 
> Will I need to replay several .log files? (To clarify, are the .log files
> each for a specific time period, or does the most recent .log file contain
> all activity since the last saved .gnucash file?)
> 
> Which .log file(s) should I use?
> 
> Which .log file(s) will "wreak havoc" on my accounts?
> 
> Thank you again,
> Confused Dan
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> If you are using Nabble or Gmane, please see 
> https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.



More information about the gnucash-user mailing list