Creating a custom error log file

Creating a custom error log file

Post by marts_poin.. » Tue, 24 Oct 2000 04:00:00



Is it possible to create a custom error log file in SQL Server 7, using
just TSQL in stored procedures?

I can get all the details I need about the events, but instead of
writing the data to a table, I want the data output to a file in the
MSSQL7\LOG folder, in the same way SQL logs itself.

Thanks in advance
Marts

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Creating a custom error log file

Post by Umachandar Jayachandra » Tue, 24 Oct 2000 04:00:00


 Several ways:
1) Use RAISERROR with LOG option to write error messages to the SQL errror
log / NT Event log itself
2) Do: xp_cmdshell 'echo Error #1>>d:\mssql7\log\my.log' & so on...
3) Use OLE automation from T-SQL with the sp_OA* SPs. You can use the
Scripting.FileSystem object in this case.

--
Umachandar Jayachandran
SQL Resources at http://www.umachandar.com/resources.htm
( Please reply only to newsgroup. )

 
 
 

1. Custom Task Error Handling - Displaying Custom Error Message

Hi,

I'm currently working on creating a custom task in VB6.
When it comes to error handling, the recommended error
handling procedure in MSDN is to bubble up the error to
the package event sink using oPackageEvent.onError().
Hence:

--- Sample Code Starts ---

Private Sub CustomTask_Execute(ByVal pPackage As Object,
ByVal pPackageEvents As Object, ByVal pPackageLog As
Object, pTaskResult As DTS.DTSTaskExecResult)
   On Error GoTo errHandler

   ' Business logic
   openConnection(param, param)

   pTaskResult = DTSTaskExecResult_Success
   Exit Sub

errHandler:

   pTaskResult = DTSTaskExecResult_Failure
   if Err.Number=xxxx Then closeConnection

   ' Bubble errors to the package eventsink
   If Not pPackageEvents Is Nothing Then
      pPackageEvents.OnError "CustomTask_Execute method
failed", Err.Number, Err.Source, Err.Description, "",
0, "", True
   End If

   Exit Sub
End Sub

--- Sample Code Ends ---

However, I notice that when error is raised, the specific
error message (Err.Description) will not be displayed on
the DTS Designer execution status dialog box. The only
message I'll get would be "The task reported failure on
execution".

I'm not sure if I have done it correctly. Anyone knows how
to get the custom error messages displayed?

Thanks!

Philip Tan

2. How many Users on Oracle

3. Errors in log file while creating shared memory

4. Show user-defined function in execution plan

5. Another Oracle "Feature" when installing 7.3.3.0.2

6. Output Custom Log File in SQL Server 7

7. Merge Replication

8. Output Custom LOg file in DTS???

9. Output custom log file in SQL Server 7

10. How to create a custom txt file in DTS to migrate data

11. Custom SortOrder - How to create the definition file?