Hi,
When i wrote my app using 16bit version of fivewin, i modified errsysw.prg so that it wrote to a diferent filename instead of overwriting error.log Also i was getting a problem with the errsysw if i had a lot of databases open and i assumed that the variable cErrorlog was getting too big, so i changed the method of writing the file error.log so that it wrote the details in sections (build the details of the error, application write to file, build the details of the dbfs write the file etc)
Since converting to 32bit i occaisionally get a recursive error, which i think means that the errsysw is actually erroring, so i removed my errsysw.
I'm now going to start to look at this problem and was going to get the latest version of errsysw and make the same changes as i initially made to the latest version and wanted to know if there is a problem if the cErrorLog string got too big?
Also, has anyone else made a similar change to errorsysw where it writes to a diferent file each time and are willing to show me how they did it, so i can compare code and see if i can improve what i'm doing?
Thanks in advance
Pete
Errsysw
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Peter,
> if there is a problem if the cErrorLog string got too big?
As we are in 32 bits, cErrorLog can be as big as 4 Gb. You will not have any problems managing strings below that limit.
> it writes to a diferent file each time
You can use FWH function cTempFile( cPath, cExtension ) --> cUniqueFileName
> if there is a problem if the cErrorLog string got too big?
As we are in 32 bits, cErrorLog can be as big as 4 Gb. You will not have any problems managing strings below that limit.
> it writes to a diferent file each time
You can use FWH function cTempFile( cPath, cExtension ) --> cUniqueFileName
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Thanks for the quick reply Antonio.
I forgot to ask another question:
In my modified Errsysw i wanted to write which user got this error message, which in my app is stored as a public variable. If i want to use the errsysw in another app, i have to remember to declare this variable or have a diferent version of errsysw. I would rather have one version, so is there a way to check if a public variable exists before trying to write this to the file?
Thanks in advance
Pete
I forgot to ask another question:
In my modified Errsysw i wanted to write which user got this error message, which in my app is stored as a public variable. If i want to use the errsysw in another app, i have to remember to declare this variable or have a diferent version of errsysw. I would rather have one version, so is there a way to check if a public variable exists before trying to write this to the file?
Thanks in advance
Pete
-
- Posts: 167
- Joined: Thu Mar 22, 2007 11:24 am
Peter
Me too has changed errsysw.prg
1) filename : Date + time
2) User was stored in a GLOBAL EXTERNAL aBediende
Frank
Me too has changed errsysw.prg
1) filename : Date + time
2) User was stored in a GLOBAL EXTERNAL aBediende
Code: Select all
#ifdef FRANKDEMONT
local cErFile
cErFile := "ERRORS\Er" + DTOS(DATE()) + "." + CharOnly("0123456789",Time()) + ".log"
....
# ifdef FRANKDEMONT
cErrorLog += " Bediende : " + aBediende[1] + CRLF
# endif
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Peter,
A better way to store user info is to put in into a function as a static var. Here is an example:
// Set/Get function example
static function getOption(nNewOption)
local nReply
static nOldOption:=1
nReply:= nOldOption
if nNewOption != nil
nOldOption:= nNewOption
endif
return nReply
You could just change the fucntion name to user().
Better yet is to create a user class and then store the oUser object in the user function. You can create a user class with DATA such as user name, password, rights, etc. Also, you could add methods for load(), save(), and edit(), so you can create a user object and save and restore it.
Then you can do this:
oUser:= TUser():new()
oUser:edit()
oUser:save()
user( oUser )
msgInfo( user():name )
msgInfo( user():rights )
etc...
You could also modify the set/get user() function to automatically return a new blank oUser if a user object was not passed and there isn't one already stored as a static.
Regards,
James
A better way to store user info is to put in into a function as a static var. Here is an example:
// Set/Get function example
static function getOption(nNewOption)
local nReply
static nOldOption:=1
nReply:= nOldOption
if nNewOption != nil
nOldOption:= nNewOption
endif
return nReply
You could just change the fucntion name to user().
Better yet is to create a user class and then store the oUser object in the user function. You can create a user class with DATA such as user name, password, rights, etc. Also, you could add methods for load(), save(), and edit(), so you can create a user object and save and restore it.
Then you can do this:
oUser:= TUser():new()
oUser:edit()
oUser:save()
user( oUser )
msgInfo( user():name )
msgInfo( user():rights )
etc...
You could also modify the set/get user() function to automatically return a new blank oUser if a user object was not passed and there isn't one already stored as a static.
Regards,
James