How to change the default error file filename.

How to change the default error file filename.

Postby HunterEC » Tue Aug 09, 2011 6:59 pm

Guys:

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


Thank you.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: How to change the default error file filename.

Postby Gale FORd » Tue Aug 09, 2011 7: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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: How to change the default error file filename.

Postby MarcoBoschi » Wed Aug 17, 2011 8:11 am

Code: Select all  Expand view
#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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: How to change the default error file filename.

Postby nageswaragunupudi » Wed Aug 17, 2011 4: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to change the default error file filename.

Postby Gale FORd » Wed Aug 17, 2011 9: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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: How to change the default error file filename.

Postby James Bott » Sat Aug 20, 2011 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: How to change the default error file filename.

Postby nageswaragunupudi » Sat Aug 20, 2011 5: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to change the default error file filename.

Postby MarcoBoschi » Sat Aug 20, 2011 6:47 pm

:D
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: How to change the default error file filename.

Postby Antonio Linares » Sun Aug 21, 2011 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42068
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to change the default error file filename.

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to change the default error file filename.

Postby HunterEC » Mon Aug 22, 2011 4: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.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 51 guests