Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event Logging with Raiserror and sp_addmessage

Status
Not open for further replies.

tls9923

Technical User
Aug 7, 2002
155
US
I have created a custom message to allow me to write to the NT event log with out being a admin. It creates the message in sysmesages and writes to the event log using raiserror but the event id, in the evetn log is 17052. And gives the the following error before it shows my message

"The description for Event ID ( 17052 ) in Source ( MSSQLSERVER ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. "

Code to add messages:

USE master
go
Exec sp_dropmessage 900001
Exec sp_dropmessage 900002
Exec sp_dropmessage 900003

EXEC sp_addmessage @msgnum = 900001,
@severity = 14,
@msgtext = 'Info Msg created on ''%s'', Msg: ''%s'' Event Id: ''%s'' Event Type: ''%s'' on ''%s'''
, @lang = 'US_English'
, @with_log = 'TRUE'

EXEC sp_addmessage @msgnum = 900002,
@severity = 15,
@msgtext = 'Warn Msg created on ''%s'', Msg: ''%s'', Event Id: ''%s'' Event Type: ''%s'' on ''%s'''
, @lang = 'US_English'
, @with_log = 'TRUE'

EXEC sp_addmessage @msgnum = 900003,
@severity = 16,
@msgtext = 'Error Msg created on ''%s'', Msg: ''%s'' Event Id: ''%s'' Event Type: ''%s'' on ''%s'''
, @lang = 'US_English'
, @with_log = 'TRUE'


Raiserror Code basic:
raiserror (900003,16,1,'adb4test','This is a test','9999','9999','10/22/05')

Why does the event log not look correct and display the error about event id 17052?

 
What NTAccount is your sqlservice account running under?
Does that account have Local Admin permissions?

Services->Mssqlserver->Properties->LogOn

Rob
 
I will need to check with the DBA and see what I can find. Does it make a difference?
 
It is running under a SQL Server Service Account and does have local admin rights.

Thanks

Terrel
 
Ok.. It seems like permissions shouldn't be a problem. (raises more questions than it answers)

What happens if you run the following statement?

Code:
declare @vc varchar(11)
set @vc = cast(getdate() as varchar(11))
raiserror ('this is %s test on %s',16,1,'a',@vc)with log
 
Once again, I will need to wait for a DBA I do not have the proper permissions to run this on the SQL servers.
 
NO problem, I have the thread marked, I will look for a response later today.

Rob
 
It shows the same error message, but with the end of the message different.

Thanks

Terrel
 
Do mean

"The description for Event ID ( 17052 ) in Source ( MSSQLSERVER ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. "

?
 
Correct. We are trying to monitor the event log for certain events and this event ID is too general. Maybe this is the best we can do but hoping for somthing different.

Thanks

Terrel
 
OK, I am not following you.

Are you trying to set up event forwarding... I.E. Send a message to a specific event server on the netowork.

or

Are you trying to send a message that is logged on the local computer.

and

DId the raiserror work when it wasn't being called a usercreated errormessage?

 
Tring to send a message to the local machine that is monitored by a tool. When we created the event log entry using Raiserror with log the top part of the message was the same along with the Event ID. Our current tool does not scan the description but we have a new one that will but not sure when it will go into production.

Thanks for any help or suggestions.

Terrel Schimpf
 
Ok... so what you are saying is that the raiserror worked, but the sp_addmessage caused a problem.

Was the problem from when you raised the error xxx or when you created the message via sp_addmessage?

What service packs are you running?


Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top