Extract of log file using DSGetLogEntry not working
Moderators: chulett, rschirm, roy
There's nothing more for me to post. Right now I'm suggesting that as a debugging aid you add calls to DSLogInfo() to your routine to see the data you are working with. Write the LogList value to the log after you fetch it. Write vEventDetail to the log after you fetch it. Etc.
They'll help you figure out where things are going wrong with your 'for loop'... something I've already mentioned.
They'll help you figure out where things are going wrong with your 'for loop'... something I've already mentioned.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Another thing - you have a list of event ids. You can't simply use that in the for loop as the from and to values... it's a list after all. Count how many entries are in the list and then loop from 1 to Count and use the loop counter to pull the Nth event id from the list and then get the log entry for it... until you run off the end of the list.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Craig,
I have modified the routine as below.
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
LogIdList = DSGetLogEventIds(hJob1, 0, 'S')
Start_EventID=Field(LogIdList,'\',1)
End_EventID=Field(LogIdList,'\',2,999)
For iEventID = Start_EventID to End_EventID Step 1
vEventDetail<-1> = DSGetLogEntry(hJob, iEventID)
next iEventID
Ans = vEventDetail
*iIgnore = DSDetachJob(hJob)
while testing it i am getting only the last event log entry which is with End_EventID.
Please suggest what needs to be changed here to get all the log entries
I have modified the routine as below.
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
LogIdList = DSGetLogEventIds(hJob1, 0, 'S')
Start_EventID=Field(LogIdList,'\',1)
End_EventID=Field(LogIdList,'\',2,999)
For iEventID = Start_EventID to End_EventID Step 1
vEventDetail<-1> = DSGetLogEntry(hJob, iEventID)
next iEventID
Ans = vEventDetail
*iIgnore = DSDetachJob(hJob)
while testing it i am getting only the last event log entry which is with End_EventID.
Please suggest what needs to be changed here to get all the log entries
RD
Ray,
Could you please tell me why unable to fetch the log entry after 10th entry
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
LogIdList = DSGetLogEventIds(hJob1, 0, 'S')
Start_EventID=Field(LogIdList,'\',1)
End_EventID=Field(LogIdList,'\',2,999)
For iEventID = Start_EventID to End_EventID Step 1
vEventDetail = vEventDetail:DSGetLogEntry(hJob, iEventID)
next iEventID
Ans = vEventDetail
*iIgnore = DSDetachJob(hJob)
Please suggest me on this code.
Could you please tell me why unable to fetch the log entry after 10th entry
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
LogIdList = DSGetLogEventIds(hJob1, 0, 'S')
Start_EventID=Field(LogIdList,'\',1)
End_EventID=Field(LogIdList,'\',2,999)
For iEventID = Start_EventID to End_EventID Step 1
vEventDetail = vEventDetail:DSGetLogEntry(hJob, iEventID)
next iEventID
Ans = vEventDetail
*iIgnore = DSDetachJob(hJob)
Please suggest me on this code.
RD
The problem is - you're not listening to what you are being told.
First off, when you call DSGetLogEventIds with the 'S' option, you are filtering your results out to just Start and End events, so you are not going to return other log events.
Your code uses hJob for the job handle but you use hJob1 in the call to DSGetLogEventIds, so unless a typo on your part don't know what you expect to get returned in your results.
Here's a quick and dirty routine you can look at:
See if that helps.
First off, when you call DSGetLogEventIds with the 'S' option, you are filtering your results out to just Start and End events, so you are not going to return other log events.
Your code uses hJob for the job handle but you use hJob1 in the call to DSGetLogEventIds, so unless a typo on your part don't know what you expect to get returned in your results.
Here's a quick and dirty routine you can look at:
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = Arg1
vEventDetail = ""
hJob = DSAttachJob(JobName, DSJ.ERRNONE)
LogIdList = DSGetLogEventIds(hJob, 0,'')
Convert "\" to @AM In LogIdList
LCnt = Dcount(LogIdList,@AM)
For x = 1 to LCnt
LId = LogIdList<x>
vEventDetail<-1> = DSGetLogEntry(hJob,LId)
Next
Ans = vEventDetail