I am trying to write entries into logging and have trouble doing so. Using Client object model on SharePoint foundation. Code is running from a console app.
SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("CustomLog1", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected,
ex.Message, ex.TargetSite.ToString());
I get the error "Object reference not set to an instance of an object" then tried this
SPDiagnosticsCategory category = new SPDiagnosticsCategory("CustomLog1", TraceSeverity.Verbose, EventSeverity.Verbose);
SPDiagnosticsService diagnosticService = SPDiagnosticsService.Local;
diagnosticService.WriteTrace(100, category, TraceSeverity.Medium,"CL tracing", "CL params");
Still same error.