Yes, it is possible, see the MSDN article: http://msdn2.microsoft.com/hi-in/library/aa979595(en-us).aspx
And here is an example code in C #:
using System; using System.Runtime.InteropServices; using Microsoft.SharePoint.Administration; namespace ManagedTraceProvider { class Program { static void Main(string[] args) { TraceProvider.RegisterTraceProvider(); TraceProvider.WriteTrace(0, TraceProvider.TraceSeverity.High, Guid.Empty, "MyExeName", "Product Name", "Category Name", "Sample Message"); TraceProvider.WriteTrace(TraceProvider.TagFromString("abcd"), TraceProvider.TraceSeverity.Monitorable, Guid.NewGuid(), "MyExeName", "Product Name", "Category Name", "Sample Message"); TraceProvider.UnregisterTraceProvider(); } } static class TraceProvider { static UInt64 hTraceLog; static UInt64 hTraceReg; static class NativeMethods { internal const int TRACE_VERSION_CURRENT = 1; internal const int ERROR_SUCCESS = 0; internal const int ERROR_INVALID_PARAMETER = 87; internal const int WNODE_FLAG_TRACED_GUID = 0x00020000; internal enum TraceFlags { TRACE_FLAG_START = 1, TRACE_FLAG_END = 2, TRACE_FLAG_MIDDLE = 3, TRACE_FLAG_ID_AS_ASCII = 4 }
}
Jason stevenson
source share