Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep previous log available #916

Closed
nvaccessAuto opened this issue Sep 18, 2010 · 8 comments
Closed

Keep previous log available #916

nvaccessAuto opened this issue Sep 18, 2010 · 8 comments
Milestone

Comments

@nvaccessAuto
Copy link

Reported by geoff on 2010-09-18 22:04
It occurs to me that there are times when it's not possible to get to the NVDA log, due to some kind of crash. This requires the use of another screen reader to retrieve the log, as a restart of NVDA will remove the log in question and replace it with a new one.

I propose that, upon start-up, NVDA rename the current log to a backup name, removing the previous back-up if there is one, and provide some means for accessing this back-up in the log viewer, etc. This would remove the dependence on another screen reader in those situations where it's not possible to use NVDA to retrieve the log.

@nvaccessAuto
Copy link
Author

Comment 1 by geoff on 2010-09-18 22:05
Changes:
Milestone changed from None to None

@nvaccessAuto
Copy link
Author

Comment 2 by briang1 on 2010-09-19 07:11
I posted this on the freelists group, which might give a fix until this ticket is actioned, assuming it is...

For those who have seen some comments about getting a log out when nvda
seems to have gone quiet, this may help. I posted it a while back but here
we go with hopefully the how to do it.

@echo off
start /w nvda.exe -q
type %temp%\nvda.log>>c:\nvdaold.log
start nvda.exe
exit

If you cut the above text from the @echo off to the exit and paste it into a
notepad text input window, then save it to the nvda folder as
nvdarun.bat,or save it elsewhere and copy it, its up to you, then go into
that folder and create a shortcut to the batch file you just saved.
Move that file to the desktop and select properties and set the shortcut
keys you want to use with it.
You can now test it with those keys.
the first time you run this it will
reboot nvda, and if you go into windows explorer you should find, in the
root directory a file called nvdaold.log. This will contain the log of the
last session. Every time you run this it should append the new log on the
end of the old one.

I have no idea if this runs foul of any security systems in Vista or 7, but it works fine in xp. If you remove one of the > before the output file name in the type line, it will only save the previous log, not keep on appending them.

@nvaccessAuto
Copy link
Author

Comment 3 by ragb on 2012-05-26 18:22
Hi,

+1 for this feature. Sometimes NVDA crashes or restarts due to the watchdog and it is hard for us to replicate steps, or ask users to start nvda with a different path for the log file.

I believe moving existing nvda.log to nvda.log.old when NVDA is initialized may help to solve most of users issues, since we can ask for the previous log file from the path. Showing the previous log on the interface is secundary, in my opinion.

It is trivial to implement. Shall I do it?

@nvaccessAuto
Copy link
Author

Comment 4 by briang1 on 2012-05-27 06:31
Well as I said in the list. This has got me out of trouble before. I used a a batch file in between the starting shortcuts and the exe file to do it, but its rather clunky of course.

Would it add much time to start up, and of course one must be careful not to screw up the commands from the run box.

@nvaccessAuto
Copy link
Author

Comment 5 by jteh (in reply to comment 3) on 2012-05-28 07:58
Replying to ragb:

I believe moving existing nvda.log to nvda.log.old when NVDA is initialized may help to solve most of users issues, since we can ask for the previous log file from the path. Showing the previous log on the interface is secundary, in my opinion.

Agreed.

It is trivial to implement. Shall I do it?

Yes please, with one change: name the file nvda-old.log instead of nvda.log.old, since I think the .log extension is opened in Notepad by default on most systems. Or maybe that was just a change I made on my own system? I can't remember... :(

@nvaccessAuto
Copy link
Author

Comment 6 by ragb (in reply to comment 5) on 2012-05-28 09:37

It is trivial to implement. Shall I do it?

Yes please, with one change: name the file nvda-old.log instead of nvda.log.old, since I think the .log extension is opened in Notepad by default on most systems. Or maybe that was just a change I made on my own system? I can't remember... :(

I believe it opens by default (unless I also did the same change and don't recall :)). The change is the folowing:

=== modified file 'source/logHandler.py'
--- source/logHandler.py    2012-05-25 02:14:15 +0000
+++ source/logHandler.py    2012-05-28 09:23:14 +0000
@@ -306,6 +306,10 @@
        else:
            if not globalVars.appArgs.logFileName:
                globalVars.appArgs.logFileName = _getDefaultLogFilePath()
+           # Keep a backup of the previous log file so we can access it even if NVDA crashes or restarts.
+           if os.path.exists(globalVars.appArgs.logFileName):
+               oldLogFileName = os.path.join(os.path.dirname(globalVars.appArgs.logFileName), "nvda-old.log")
+               os.rename(globalVars.appArgs.logFileName, oldLogFileName)
            # Our FileHandler always outputs in UTF-8.
            logHandler = FileHandler(globalVars.appArgs.logFileName, mode="wt")
    else:

Shall I commit it to main or releases/2012.2?

@nvaccessAuto
Copy link
Author

Comment 7 by jteh on 2012-05-28 13:04
You should catch OSError for the rename call. In fact, you can probably just try renaming, catch OSError and pass on exceptions. There's probably no point in checking for the existence of the file because we don't care if the rename fails anyway.

You can commit this to main. 2012.2 is now closed for anything other than major bugs or translation updates. Thanks!
Changes:
Milestone changed from None to 2012.3

@nvaccessAuto
Copy link
Author

Comment 8 by elliott94 on 2012-05-28 21:06
Fixed in 9658bbd.
Changes:
State: closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant