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.



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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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