 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Joshua Youngblood
Joined: 14 Apr 2006 Posts: 82 Country: United States |
|
Logging of Errors |
|
We're running the following code that we expect to not find a file occasionally:
 |
 |
onerrorresumenext
filesize source_file_path, file_size
...
|
The onerrorresumenext is correctly allowing the script to continue, but the error ("A run-time error occurred while executing automation script: Line ##. File not found.") is still being logged. Is there any way to prevent the logging by 24x7? We do not want to prevent the logging of all errors in the script. We just want to prevent the logging of the expected error.
|
|
Mon Sep 21, 2009 3:34 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
This is being logged as a warning, not as an error. Am I right?
I guess you can suppress this logging if you check "Ignore Errors" job property. You can always write your custom errors and messages to the log using LogAddMessageEx statement. Hope it works for you.
|
|
Mon Sep 21, 2009 4:48 pm |
|
 |
Joshua Youngblood
Joined: 14 Apr 2006 Posts: 82 Country: United States |
|
|
|
 |
 |
This is being logged as a warning, not as an error. Am I right? |
A: In the log file, what would indicate that it's a warning? Yes, the script continues without crashing, but the log message generated by 24x7 uses the word "error".
 |
 |
I guess you can suppress this logging if you check "Ignore Errors" job property. You can always write your custom errors and messages to the log using LogAddMessageEx statement. |
Response: Can the "Ignore Errors" property be set and unset by the job while it is running? We cannot "Ignore Errors" for the entire job. We can only do it for the "filesize" check that I showed you in the previous example. We would still like the program to crash and/or log all other non-custom errors.
|
|
Mon Sep 21, 2009 5:09 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
On the screen, in the Log Viewer warning messages are displayed using yellow warning icons. In the log file they are represented by value 1 in the message type column - this is the second column from left. Just in case, 0 type means INFO, 1 - WARNIG, 2 - ERROR.
To avoid the entire issue with not found file, you can add FileExists check (or better use Dir) and analyze the result before calling FileSize.
|
|
Mon Sep 21, 2009 5:24 pm |
|
 |
Joshua Youngblood
Joined: 14 Apr 2006 Posts: 82 Country: United States |
|
|
|
You are correct, then. It is being logged as a warning. Thanks for the information. It is enough to help me get the desired results.
I cannot use FileExists, because it returns true even if the file isn't finished being written, yet. See a previous post that I did in December of 2008, entitled "File Move Issues".
|
|
Mon Sep 21, 2009 5:38 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
 |
 |
I cannot use FileExists, because it returns true even if the file isn't finished being written |
Understand.
I only meant using FileExists or Dir before calling FileSize, and only calling FileSize in case the FileExists check returns TRUE.
|
|
Mon Sep 21, 2009 5:55 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|