SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
How can I insert the error message into the database

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
How can I insert the error message into the database
Author Message
mojoyrider



Joined: 07 Aug 2007
Posts: 20

Post How can I insert the error message into the database Reply with quote
I am using the following sql statment in the OnStart and OnFinish and OnError in the job Notification and Actions

INSERT INTO JobLog (SID, JobNumber, JobName, RunDate, JobMessage) VALUES ('200', @V"job_id", '@V"job_name"',GetDate(),'@V"event"')

This works perfectly recording START, FINISH and ERROR in the JobMessage in a SQL Express database

However, when there is an ERROR, I need to display the error message that appears in the log to be inserted. I have reviewed the documentation and macros and I can't find one that represents the error message.

I would appreciate any help you can offer in getting the error message to be inserted as well.
Sat Jan 12, 2008 7:43 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Reply with quote
I'm afraid in the notification event you cannot obtain the error message of the error caught by the job. Two common solutions are used to deal with that

1. Insert a generic error message like "An error occurred in job @V"job_name" see job log for details."

2. Don't insert each event in a real time. Instead schedule a job running every 10-15 minutes to load schedule.log into a staging table and then from that table copy only new records to the log table, a simple INSERT..SELECT SQL query with a subquery to find max event time can be used for such purpose.

Note that schedule.log is a tab separated file and can be easily loaded into a SQL Server database using BCP utility, or event build in DatabaseImport method available in 24x7

By the way, if you run a lot of jobs, inserting messages in a real time may make you system unstable. Virtually all database drivers are known to loose some system resources during frequent connects/disconnects.
Sun Jan 13, 2008 3:54 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.