Toad World® Forums

Automation script doesn't seem to be logging a scheduled run


#1

It seems that some of my automation scripts are failing to write to their log file when they are run on a schedule. For example I have a script that I ran manually on 1/24/2013 and it properly logged the process in its log file. That script is scheduled to run daily and yet the log file still only shows the events from 1/24/2013. I know the script is running because I date stamp data that is being exported in the script and the date stamp is current with the most recent scheduled run. Any thoughts?

Thanks,

Jacob


#2

There’s another thing I don’t quite understand which may or may not be related to what I described above. I have an automation script which is not scheduled which seems to be running according to its log file.


#3

Go to windows scheduler and look at all of the return codes of your automation scripts. Perhaps they are kicked off but having a failure in the middle of the run. Try to post a full screenshot of the scheduled tasks including return code and comment.


#4

I do have a failure code because the script timed out after 4 hours. So does that mean that a script won’t log if it fails?


#5

Also is there some additional overhead to running a script as a Windows task? One of my tasks takes around 3 mins to complete when running manually from Toad, however it took around 30 mins when run from Windows scheduler.


#6

If an automation script has an exception it will log this exception and the exit code will be 999. If you have your script set to continue if there is an error, the log file will record an error and the exit code will be 111. Windows explorer has Hex return codes so you have to translate to decimal.

If your connection timed out, that would be logged but not recorded as an error. Try going to your Options and increase the timeout values.

I do not know of any huge overhead from running from windows scheduler, just the start up time it takes to run TDP. But I have not paid close attention to this.


#7

However it took around 30 mins when run from Windows scheduler.


#8

I have been doing some testing and I think I might be on to something. The automation script that I am having the logging issues with is a parent script which calls several child scripts. It seems as though logging for a script doesn’t happen when it’s called from another script. For example, ScriptParent is scheduled and calls ScriptChild1 and ScriptChild2. When checking for log messages I only see messages in ScriptParent’s log file while there are no messages for either of the child scripts. It is more important that I have log messages for the child scripts than for the parent script.

Wondering if you are able to recreate this and if so, is this working as intended or a bug?


#9

I was wondering the same thing. I have a ‘.tas within a .tas’ on a scheduled Windows task that emails me this, but there is no attached log file:
Error in CTMA Due/Overdue notifications
Automation script “WeeklyCTMA” had errors while executing. The exception messages are listed below and the log file is attached.
Exception Messages:
Set_Variable_1 - Unable to cast object of type ‘System.DBNull’ to type ‘System.String’.
File not found: C:\Users\xxxx\AppData\Roaming\Quest Software\Toad Data Point 3.4\Automation\WeeklyCTMA_TPMnotif.log

I find a .log file in that folder named for the parent .tas ‘WeeklyCTMA’, but not the one for the child .tas ‘WeeklyCTMA_TPMnotif’ which it seems to expect.

I’m still trying to determine why my Set_Variable isn’t working, when it worked in 3.2.


#10

Merging the log file of a child script is an enhancement we have not done. I entered this as QAT-1826 but I know it will not make it into the next release. For now I would just manually include the child lot files in your success and failure emails.


#11

Julian, how is your variable set? Is a SQL executed to fill the variable? If so it seems that the result type is erroring when being cast to string. Can you provide more detail on how the variable is set?


#12

Thanks for the reply Debbie. I guess I’ll just schedule each automation task individually for now to capture logging.

I have two screenshots to show what I was getting at with my additional overhead question. One screenshot shows my task in Windows Task Scheduler and I highlighted the time at which I manually ran the task. The second screenshot shows the log file for the automation script and the time stamps for when it started. There’s roughly a 30 minute delay between when I started the task and when logging started. The last screenshot shows the log file that resulted from me manually starting the task from Toad. The run time on that is 50 seconds. Any idea why there would be such a big discrepancy between run times?

WTM_SS.jpeg

Log_SS.jpeg

Log2_SS.jpeg


#13

Wow. that is fascinating. The only thing I can think of that is the the operating system is having a hard time starting the app.

Let’s try this. Try running the jobs command line and look and see how long it takes before you see a Toad icon running in the tray on the right had side of your desktop. Or you could look at see in the processes window.

The task command line should look something like this.

“C:\Program Files (x86)\Quest Software\Toad Data Point 3.5\toad.exe” -batch=true “C:\Users\dpeabody\Documents\Script_1.tas”

I need to narrow down the issue between start up time or compile time.

Debbie


#14

Regarding the set_variable issue, with Send Email: thanks Debbie for your offline reply:

Interesting problem. We are not handling nulls or empty strings well. The only way I see around this is to handle this in your SQL. Add a null value type function and enter your email address as the null value…I have entered QAT-1867 for these two issues regarding the handling of null with variables.


#15

Hi all

In the above conversation below quote is Available, I need to run the Scheduled scripts should run if Oracle error also how to change the error Log 999 to 111, It should be handle in Script level then what is the code need to write…?

Quote

If an automation script has an exception it will log this exception and the exit code will be 999. If you have your script set to continue if there is an error, the log file will record an error and the exit code will be 111. Windows explorer has Hex return codes so you have to translate to decimal.

Unquote

Thanks & Regards

Janagiraman.S


#16

Do I understand correctly that you just want your script to continue execution even after database error occurs? I so, select Setting activity (the topmost one in the designer) and press Continue On Error button in the activity input control under the designer area.

In case I misunderstood you, can you please clarify your problem?

Thank you,

Igor.


#17

JWilliams,

If your log file is set to verbose it can really slow down your job depending on what your job is doing. Try changing that setting and see if it runs faster when scheduled. Also, if you want to see the child logs (make sure those are not set to verbose also) have them write to the same log file as the parent but make sure the check box to truncate the log file is not checked (you want it to append).


#18

Add to your script an email at the end that attaches the log file. Use the path in the settings logging folder and append the name of the script. This will give you the log file that ran with the script.

Another way of doing this if you are unsure of the path is to add the Throw error activity and add sending error emails and include log file.

Either of these two ways will prove or disprove the logging is occurring. If you never get the email then the script isn’t’ running.