internal static void InitializeTracing() { TraceConfig.InitializeFromConfigStore(); FabricCodePath = FabricEnvironment.GetCodePath(); FabricLogRoot = FabricEnvironment.GetLogRoot(); }
public void TestConfigStoreTraceConfig() { lock (ContextLock) { var onFilterUpdateCalledCount = 0; TraceConfig.OnFilterUpdate += sinkType => { switch (sinkType) { case TraceSinkType.ETW: Assert.IsTrue( TraceConfig.GetEventEnabledStatus(sinkType, EventLevel.Informational, EventTask.None, string.Empty), "ETW should allow info traces."); Assert.IsFalse( TraceConfig.GetEventEnabledStatus(sinkType, EventLevel.Verbose, EventTask.None, string.Empty), "ETW shouldn't allow verbose traces."); Assert.IsTrue( TraceConfig.GetEventEnabledStatus(sinkType, EventLevel.Verbose, FabricEvents.Tasks.FabricDCA, "ServiceResolver"), "ETW should allow DCA.ServiceResolver verbose traces."); Assert.IsTrue(TraceConfig.GetEventProvisionalFeatureStatus(sinkType), "ETW should have Provisional Featue Enabled"); break; case TraceSinkType.Console: Assert.IsTrue( TraceConfig.GetEventEnabledStatus(sinkType, EventLevel.Error, EventTask.None, string.Empty), "Console should allow error traces."); Assert.IsFalse( TraceConfig.GetEventEnabledStatus(sinkType, EventLevel.Warning, EventTask.None, string.Empty), "Console shouldn't allow warning traces."); break; case TraceSinkType.TextFile: Console.WriteLine("Entering - TextFile"); Assert.IsTrue( TraceConfig.GetEventEnabledStatus(sinkType, EventLevel.Verbose, EventTask.None, string.Empty), "Text file should allow all traces."); break; default: Assert.Fail("Unknown sink type filter updated" + sinkType); break; } onFilterUpdateCalledCount++; }; var mockConfigReader = new Mock <TraceConfig.IConfigReader>(MockBehavior.Strict); mockConfigReader.Setup(cr => cr.GetSections()).Returns(new[] { "Trace/File", "Trace/Etw", "Trace/Console" }); SetMockConfig(mockConfigReader, "Trace/File", EventLevel.Verbose, null, "DoesntMatter.trace"); SetMockConfig(mockConfigReader, "Trace/Etw", EventLevel.Informational, "FabricDCA.ServiceResolver:5"); SetMockConfig(mockConfigReader, "Trace/Console", EventLevel.Error); TraceConfig.InitializeFromConfigStore(mockConfigReader.Object); Assert.AreEqual(3, onFilterUpdateCalledCount); } }
static AppTrace() { // Try reading config TraceConfig.InitializeFromConfigStore(); // Create the trace source AppTrace.traceSource = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.SystemFabric); }
static FileImageStore() { // Try reading config (this may require access to tracing which is why we setup something up above TraceConfig.InitializeFromConfigStore(); // Create the trace source based on the config FileImageStore.traceSource = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.ImageStoreClient); }
public static int Main(string[] args) { TraceConfig.InitializeFromConfigStore(); int status = new ManualTester().Execute(args); return(status); }
static ImageBuilderExe() { TraceConfig.InitializeFromConfigStore(); ImageBuilderExe.TraceSource = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.ImageBuilder); #if !DotNetCoreClr ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; #endif }
public void TestEmptyConfigStoreTraceConfig() { lock (ContextLock) { var mockConfigReader = new Mock <TraceConfig.IConfigReader>(MockBehavior.Strict); mockConfigReader.Setup(cr => cr.GetSections()).Returns(new string[0]); TraceConfig.InitializeFromConfigStore(mockConfigReader.Object); AssertDefaultTracingConfig(); } }
static ImageStoreClient() { // Try reading config TraceConfig.InitializeFromConfigStore(); // Create the trace source based on the config ImageStoreClient.TraceSource = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.ImageStoreClient); #if !DotNetCoreClr ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; #endif }
static DeployerTrace() { #if DotNetCoreClrLinux // TODO - Following code will be removed once fully transitioned to structured traces in Linux // this is used to read the configuration which tells whether to use structured traces in Linux. TraceConfig.InitializeFromConfigStore(); #endif traceSource = FabricEvents.ExtensionsEvents.GetEventSource(FabricEvents.Tasks.FabricDeployer); TraceConfig.SetDefaultLevel(TraceSinkType.Console, EventLevel.Error); TraceConfig.SetDefaultLevel(TraceSinkType.ETW, EventLevel.Informational); }
public static void Run() { TraceConfig.InitializeFromConfigStore(); using (var runtime = FabricRuntime.Create()) { runtime.RegisterStatelessServiceFactory("TokenValidationServiceType", new TokenValidationServiceFactory()); Console.ReadKey(); } }
static ServerUtility() { TraceConfig.InitializeFromConfigStore(); #if !DotNetCoreClr // "System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel" // may be encountered when making HttpWebRequest calls to an https endpoint if the cipher suites // have been modified according to "https://requirements.azurewebsites.net/Requirements/Details/6417" // ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; #endif }
public static int Main(string[] args) { TraceConfig.InitializeFromConfigStore(); Console.CancelKeyPress += Console_CancelKeyPress; Trace.ConsoleWriteLine(TraceType, "Microsoft Azure Service Fabric Upgrade Service Host"); Trace.ConsoleWriteLine(TraceType, "Copyright (c) Microsoft Corporation"); Console.WriteLine(); Trace.ConsoleWriteLine(TraceType, "Registering Upgrade service..."); #if !DotNetCoreClr ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; #endif using (var runtime = FabricRuntime.Create()) { factory.RegisterUpgradeSystemService(runtime); Trace.ConsoleWriteLine(TraceType, "Upgrade Service host ready. Press [Enter] to exit ..."); Console.ReadLine(); } return(0); }
static ServiceTrace() { TraceConfig.InitializeFromConfigStore(); Source = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.ServiceFramework); }
static ImageBuilderExe() { TraceConfig.InitializeFromConfigStore(); ImageBuilderExe.TraceSource = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.ImageBuilder); }
static BackupCopier() { TraceConfig.InitializeFromConfigStore(); BackupCopier.TraceSource = new FabricEvents.ExtensionsEvents(FabricEvents.Tasks.BackupCopier); BackupRestoreUtility.TraceSource = BackupCopier.TraceSource; }
public void TestInitialize() { TraceConfig.InitializeFromConfigStore(testReader); TraceConfig.SetDefaultLevel(TraceSinkType.ETW, EventLevel.Informational); }
public static int Main(string[] args) { // To enable breakForDebugger, add the <Arguments> tag in servicemanifest.xml as shown // <EntryPoint> // <ExeHost> // <Program>FabricIS.exe</Program> // <Arguments>-debug</Arguments> // </ExeHost> // </EntryPoint> bool breakForDebugger = false; bool appMode = false; for (int i = 0; i < args.Length; ++i) { string command = args[i].TrimStart('-', '/').ToLowerInvariant(); switch (command) { case "debug": breakForDebugger = true; break; case "app": appMode = true; break; default: TraceType.ConsoleWriteLine("WARNING: Ignoring unknown argument: {0}", args[i]); break; } } if (breakForDebugger) { TraceType.ConsoleWriteLine("Waiting for debugger. Press [Enter] to continue execution ..."); Console.ReadLine(); } TraceConfig.InitializeFromConfigStore(); Console.CancelKeyPress += Console_CancelKeyPress; TraceType.ConsoleWriteLine( "Service Fabric Infrastructure Service starting up in {0} mode", appMode ? "user application" : "system service"); if (appMode) { using (var runtime = FabricRuntime.Create()) { runtime.RegisterStatefulServiceFactory("InfrastructureServiceType", ServiceFactory.CreateAppServiceFactory()); int status = WaitForProgramClosure(); return(status); } } else { ServiceFactory.CreateAndRegister(); int status = WaitForProgramClosure(); return(status); } }