View previous topic :: View next topic |
Author |
Message |
silicondale
Joined: 15 Mar 2007 Posts: 252 Location: Matlock, Derbyshire, UK
|
Posted: Mon Mar 26, 2012 8:48 am Post subject: Runtime error messages to file instead of popup window? |
|
|
I have made a lot of progress with development of FTN95 / classicASP web applications. These require all I/O to be done via files, and I have set the standard input and output streams to read from and write to files. However, still a problem with run-time error messages which still expect to open a window and await user response via mouse/keyboard. These are clearly unavailable on a web server, and the program just hangs, requiring a server restart.
I can get around this by using the TRAP_EXCEPTION@ method, but am not confident that I am trapping all errors - and it's very fiddly to program it to give me even an approximate error location. The traceback that is given in the normal runtime error window would be very useful.
It would be helpful if there were some better way of handling this without having to use TRAP_EXCEPTION@ - like redirecting the normal fatal error message to the standard output stream, and then simply terminating the program without waiting for a response. Couldn't find anything in the manuals, but is there perhaps something undocumented (or documented but I just haven't found yet!) to do this ? _________________ (Steve Henley) |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Mar 27, 2012 11:59 am Post subject: |
|
|
The following information may be relevant...
"To convert a .NET runtime dialog failure message to a console message, change the following registry key from 1 to 5...
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgJITDebugLaunchSetting" |
|
Back to top |
|
 |
silicondale
Joined: 15 Mar 2007 Posts: 252 Location: Matlock, Derbyshire, UK
|
Posted: Tue Mar 27, 2012 12:10 pm Post subject: |
|
|
Hi Paul - thanks for the suggestion, but three problems ! (a) it isn't a .NET program, it's just a straight FTN95 .EXE, (b) it does the opposite of what I need. On a web server the last thing you want is console messages - the error message must go to a file and it must not wait for user response via non-existent mouse/keyboard, and (c) fiddling with registry keys on a local computer in front of me is dangerous enough. Trying to do it by Windows remote desktop on a virtual server is quite another matter. Any mistake could kill the server!
What I need is actually something very simple. Error messages from an ordinary Fortran95 .EXE program to be written to STDOUT which I have already directed to a file - and for the program then to exit unconditionally rather than waiting for the user to respond. _________________ (Steve Henley) |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Mar 27, 2012 12:43 pm Post subject: |
|
|
I was thinking that console messages have the potential for being redirected whereas you cannot do much with a dialog message.
For Win32, runtime dialog error messages are converted to console messages when you set the following environment variable.
SET SALFENVAR=kill_dialogbox
Sometimes you can get redirected output by simply using
prog.exe > output.dat
on the command line. |
|
Back to top |
|
 |
silicondale
Joined: 15 Mar 2007 Posts: 252 Location: Matlock, Derbyshire, UK
|
Posted: Tue Mar 27, 2012 1:03 pm Post subject: |
|
|
Ah, I see what you mean.... Yes, it's the popup dialog messages that are the problem. I shall try the enviropnment variable you mention - wasn't aware that this was available (is it actually documented somewhere?) _________________ (Steve Henley) |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Mar 27, 2012 4:48 pm Post subject: |
|
|
I don't think it is documented. |
|
Back to top |
|
 |
silicondale
Joined: 15 Mar 2007 Posts: 252 Location: Matlock, Derbyshire, UK
|
Posted: Tue Mar 27, 2012 7:01 pm Post subject: |
|
|
OK, many thanks for the suggestion. I have tried it and it does the more important half of the job, in suppressing the dialog box. I also lose the error traceback of course, but this is better than nothing, because any program that finds its way to the website should already be fairly thoroughly tested and debugged.
I then tried to be clever and set the environment variable from within the program by using CISSUE:
CALL CISSUE ('SET SALFENVAR=kill_dialogbox',IFAIL)
but unfortunately this didn't work. A pity. It means that I'll need to set it through remote desktop - and work out how to do this automatically each time the server is restarted. I didn't really want to get that deeply enmeshed in Windows server settings - it would be much simpler to do this directly from the running Fortran program (and use the same method to blank out the environment variable on program termination). _________________ (Steve Henley) |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Mar 28, 2012 4:22 pm Post subject: |
|
|
You could use SetEnvironmentVariable. The interface is in win32api.ins.
The dll is kernel32.dll and I think that SLINK will automatically link this in for you.
It should not be necessary to remove the environment variable because it will be local to the current process. |
|
Back to top |
|
 |
silicondale
Joined: 15 Mar 2007 Posts: 252 Location: Matlock, Derbyshire, UK
|
Posted: Wed Mar 28, 2012 6:03 pm Post subject: |
|
|
Many thanks, Paul - excellent stuff. Will give that a whirl, and that should do what is needed! _________________ (Steve Henley) |
|
Back to top |
|
 |
|