Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I developed a ActiveX Component (C#) for SharePoint 2010 and would like to send log/debug messages to the SP-Server so that they are viewable in the SharePoint LOGS Folder. How am I doing this?

Like the server-side SPDiagnosticsService.Local.WriteTrace(...) function. Isn't there any Client-Object-Model function to do this? Or maybe in Javascript, I guess I could call a Script aswell.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

http://www.codeproject.com/Articles/620996/Five-suggestions-to-implement-a-better-logging-in

Suggestion #5 – Utilize diagnostics.asmx web service for the client side applications

It turns out that SharePoint has a /_vti_bin/diagnostics.asmx web service. It has only one method which performs log writing to the ULS with “SharePoint Foundation -> Unified Logging Service” category and “Verbose” level.

If you are crafting Silverlight or JavaScript application, then that web service could be the only way to perform logging which could be accessible by developers or administrators. Other options are quite hard to implement.

SharePoint has lots of Java Script libraries, and it also has functions such as ULSOnError(msg, url, line) and ULSSendException(ex). One does not simple call these functions, so you just need to include additional call ULS.enable with “true” value. Otherwise, you will not get anything at all.

ULS.enable = true;
ULSOnError("Hello trace", document.location.href, 0);

Then you call this JavaScript from your ActiveX Code.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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