FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to change the default error file filename.
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
How to change the default error file filename.
Posted: Tue Aug 09, 2011 06:59 PM

Guys:

How can I rename the default filename for the error log (Error.log) during program execution ?

Thank you.

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: How to change the default error file filename.
Posted: Tue Aug 09, 2011 07:26 PM

Here is what I do for error and trace log files.
cLogFile := gete('username')
Set( _SET_ERRORLOG, cLogFile+'_diwin.err' )
Set( _SET_TRACEFILE, cLogFile+'_diwin.log' )

You can also do the following for the error log file.
Set errorlog to filename

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: How to change the default error file filename.
Posted: Wed Aug 17, 2011 08:11 AM
Code (fw): Select all Collapse
#include "fivewin.ch"
FUNCTION MAIN()

SET ERRORLOG TO myerrorfile.log

USE nothing

RETURN NIL

This program goes in error and produce error.log not myerrorfile.log
King regards
marco
Marco Boschi
info@marcoboschi.it
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to change the default error file filename.
Posted: Wed Aug 17, 2011 04:54 PM

FW provides for setting path to write error.log file, but does not provide for a different name for error.log file.

We may set a different folder where the error.log is written by calling function SetErrorPath( cNewPath ) --> cOldPath.

cNewPath should end with "\".

Error.log file will be written in cNewPath + "Error.log"

Regards



G. N. Rao.

Hyderabad, India
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: How to change the default error file filename.
Posted: Wed Aug 17, 2011 09:34 PM

I use xHarbour commercial so it may support the error log filename.
This is from the documentation.

Syntax
SET ERRORLOG TO <cLogFile> [ADDITIVE]

Arguments
<cLogFile>
This is the name of the file that stores information about runtime errors. The default file is named "Error.log"
ADDITIVE
If this option is specified, new error information is appended to the log file. Otherwise, <cLogFile> is overwritten when a new error occurs. Description
The SET ERRORLOG command is used in customized error handling routines where error information about runtime errors is written to a user-defined file. By default, runtime error information is stored in the Error.log file.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: How to change the default error file filename.
Posted: Sat Aug 20, 2011 02:31 PM

Hunter,

The filename is hardcoded in errsysw.prg. You can just change it there and compile and add the OBJ to your link script. I have done this in the past. Actually, I modified it to create a new sequential filename for each new error so I could review all the errors that an app had generated. You could even set it up to email the error file to you.

We might suggest to Antonio that it would be nice to have a SetErrorFilename() function similar to the existing SetErrorPath() function. Then we wouldn't have to modify the source. This wouldn't, however, allow you to have incremental filenames. This would be another nice feature that could be turned on with just a flag.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to change the default error file filename.
Posted: Sat Aug 20, 2011 05:31 PM
We might suggest to Antonio that it would be nice to have a SetErrorFilename() function similar to the existing SetErrorPath() function.

Good suggestion.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: How to change the default error file filename.
Posted: Sat Aug 20, 2011 06:47 PM

:D

Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to change the default error file filename.
Posted: Sun Aug 21, 2011 07:49 AM
  • New: functrion SetErrorFileName( <cNewFileName> ) --> cOldFileName lets you assign and retrieve
    the filename used to save the error log information.

Implemented for next FWH build :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to change the default error file filename.
Posted: Sun Aug 21, 2011 11:17 AM
You could even set it up to email the error file to you.


It is easy to set up any action with the generated error.log file, including email the file, without modifying the errorsysw.prg.

We can set up a posterror action codeblock with this function

SetPostErrorAction( { |cErrorLogFileName, oError| MyAction( cErrorLogFileName, oError ) } ) --> PreviousBlock

We can implement email functionality or any other action within function MyAction( ... )
Regards



G. N. Rao.

Hyderabad, India
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: How to change the default error file filename.
Posted: Mon Aug 22, 2011 04:09 AM

Antonio & Rao:

Great discussion. Good to know that it will be implemented. Thank you to all you guys who posted on this thread.

Continue the discussion