SharePoint write text to the ULS logging system from code
//SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("xxxx", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, intPageCount, "ex.StackTrace");
//SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("yyyy", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, intRecordCount.ToString(), "ex.StackTrace");