1

I have developed a SQL CLR stored procedure in C#, for SQL Server 2012.

I want to log messages to SQL Server registers. On a normal stored procedure I use xp_logevent

What can I use to log a message in a SQL CLR stored procedure?

1 Answer 1

2

Why not just execute xp_logevent via SqlContext.Pipe.ExecuteAndSend() in your catch block?

2
  • Yes, you are right but I thought that there is another better method to do it. Thanks.
    – VansFannel
    Jun 17, 2015 at 13:52
  • @VansFannel I cannot think of another method to do this, let alone a better one. Even if you did write to the Windows Event Log, I don't see how you would be able to write to the SQL Server Event Log from SQLCLR. Jun 18, 2015 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.