0

This starts sounding more and more silly the longer I think about it, but is there a way I can utilize the ULS Tracing service programmatically but have it write to another file, not the default XXXXXXX-DATE.log file?

I work with a farm that provides hosting for tenants, and with their custom code many of them like to write trace events to ULS but when digging for platform level errors it becomes a pain to start adding filters to ULS Viewer. I'd also like to separate concerns here so that if any particular tenant needs a log dump it would be easier on my end.

I've been digging into the SPDiagnosticsServiceBase class and even so far down into beginning to look into the ULS class itself to see if there was anything I could pick up but so far I'm not seeing much in terms of where I can inject a path and custom naming convention.

Perhaps the issue here is, the tenants shouldn't be writing to the ULS logs. However, I would like to explore the idea of writing out their diagnostic checks in the same format that ULS Viewer can read.

Any ideas or points in the right direction would be greatly appreciated.

2 Answers 2

0

What about writing a script that copies the ULS as it's written, and separates out the built-in and custom lines? This way, you don't have to hack any core code (yikes!), and you can provide the users with either or both logs.

0

IMO you shouldn't mess with Diagnostics Service. It is writing to centralized log for a reason.

Instead I would try to convince tenants to write Product information in their logging records. This way you can filter records by respected product and even send filtered reports using ULS Viewer.

Personally, I like to map a feature to product field in ULS.

1
  • That's how it is now, but there's literally thousands of Unexpected logs being written per minute from that Category. The wrapper class created by the tenant sets any tracing to Unexpected so I'm trying to avoid that in the future and thought to separate them out by file as well would be nice as well.
    – EHorodyski
    Dec 17, 2014 at 18:37

Your Answer

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

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