THRIFT-4824 Logger deprecation warnings in tutorial
Client: netstd
Patch: Jens Geyer

this closes #1760
diff --git a/lib/netstd/Thrift/Transport/Client/TTlsSocketTransport.cs b/lib/netstd/Thrift/Transport/Client/TTlsSocketTransport.cs
index 98fb982..9295bb0 100644
--- a/lib/netstd/Thrift/Transport/Client/TTlsSocketTransport.cs
+++ b/lib/netstd/Thrift/Transport/Client/TTlsSocketTransport.cs
@@ -1,4 +1,4 @@
-// Licensed to the Apache Software Foundation(ASF) under one
+// Licensed to the Apache Software Foundation(ASF) under one
 // or more contributor license agreements.See the NOTICE file
 // distributed with this work for additional information
 // regarding copyright ownership.The ASF licenses this file
@@ -123,7 +123,7 @@
 
                 var addr = entry.AddressList[0];
 
-                _host = new IPAddress(addr.GetAddressBytes(), addr.ScopeId); ;
+                _host = new IPAddress(addr.GetAddressBytes(), addr.ScopeId);
                 _port = port;
                 _timeout = timeout;
                 _certificate = certificate;
@@ -264,4 +264,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/test/netstd/Client/TestClient.cs b/test/netstd/Client/TestClient.cs
index c6b086f..ddc36ac 100644
--- a/test/netstd/Client/TestClient.cs
+++ b/test/netstd/Client/TestClient.cs
@@ -994,9 +994,9 @@
                 Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
             }
 
+            Console.WriteLine("Test Oneway(1)");
             var sw = new Stopwatch();
             sw.Start();
-            Console.WriteLine("Test Oneway(1)");
             await client.testOnewayAsync(1, MakeTimeoutToken());
             sw.Stop();
             if (sw.ElapsedMilliseconds > 1000)
diff --git a/tutorial/netstd/Client/Program.cs b/tutorial/netstd/Client/Program.cs
index bf35746..4b68cee 100644
--- a/tutorial/netstd/Client/Program.cs
+++ b/tutorial/netstd/Client/Program.cs
@@ -31,12 +31,14 @@
 using Thrift.Transport.Client;
 using tutorial;
 using shared;
+using Microsoft.Extensions.DependencyInjection;
 
 namespace Client
 {
     public class Program
     {
-        private static readonly ILogger Logger = new LoggerFactory().AddConsole().AddDebug().CreateLogger(nameof(Client));
+        private static ServiceCollection ServiceCollection = new ServiceCollection();
+        private static ILogger Logger;
 
         private static void DisplayHelp()
         {
@@ -75,6 +77,9 @@
         {
             args = args ?? new string[0];
 
+            ServiceCollection.AddLogging(logging => ConfigureLogging(logging));
+            Logger = ServiceCollection.BuildServiceProvider().GetService<ILoggerFactory>().CreateLogger(nameof(Client));
+
             if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase)))
             {
                 DisplayHelp();
@@ -89,6 +94,13 @@
             }
         }
 
+        private static void ConfigureLogging(ILoggingBuilder logging)
+        {
+            logging.SetMinimumLevel(LogLevel.Trace);
+            logging.AddConsole();
+            logging.AddDebug();
+        }
+
         private static async Task RunAsync(string[] args, CancellationToken cancellationToken)
         {
             var numClients = GetNumberOfClients(args);
diff --git a/tutorial/netstd/Server/Program.cs b/tutorial/netstd/Server/Program.cs
index 1d9dd15..d27e90d 100644
--- a/tutorial/netstd/Server/Program.cs
+++ b/tutorial/netstd/Server/Program.cs
@@ -41,12 +41,17 @@
 {
     public class Program
     {
-        private static readonly ILogger Logger = new LoggerFactory().AddConsole(LogLevel.Trace).AddDebug(LogLevel.Trace).CreateLogger(nameof(Server));
+        private static ServiceCollection ServiceCollection = new ServiceCollection();
+        private static ILogger Logger;
 
         public static void Main(string[] args)
         {
             args = args ?? new string[0];
 
+            ServiceCollection.AddLogging(logging => ConfigureLogging(logging));
+            Logger = ServiceCollection.BuildServiceProvider().GetService<ILoggerFactory>().CreateLogger(nameof(Server));             
+
+
             if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase)))
             {
                 DisplayHelp();
@@ -66,6 +71,13 @@
             Logger.LogInformation("Server stopped");
         }
 
+        private static void ConfigureLogging(ILoggingBuilder logging)
+        {
+            logging.SetMinimumLevel(LogLevel.Trace);
+            logging.AddConsole();
+            logging.AddDebug();
+        }
+
         private static void DisplayHelp()
         {
             Logger.LogInformation(@"
@@ -131,12 +143,10 @@
 
         private static async Task RunSelectedConfigurationAsync(Transport transport, Protocol protocol, CancellationToken cancellationToken)
         {
-            var fabric = new LoggerFactory().AddConsole(LogLevel.Trace).AddDebug(LogLevel.Trace);
             var handler = new CalculatorAsyncHandler();
             ITAsyncProcessor processor = null;
 
             TServerTransport serverTransport = null;
-
             switch (transport)
             {
                 case Transport.Tcp:
@@ -209,6 +219,7 @@
                 Logger.LogInformation(
                     $"Selected TAsyncServer with {serverTransport} transport, {processor} processor and {inputProtocolFactory} protocol factories");
 
+                var fabric = ServiceCollection.BuildServiceProvider().GetService<ILoggerFactory>();
                 var server = new TSimpleAsyncServer(processor, serverTransport, inputProtocolFactory, outputProtocolFactory, fabric);
 
                 Logger.LogInformation("Starting the server...");
@@ -288,8 +299,11 @@
                     .UseUrls("http://localhost:9090")
                     .UseContentRoot(Directory.GetCurrentDirectory())
                     .UseStartup<Startup>()
+                    .ConfigureLogging((ctx,logging) => ConfigureLogging(logging))
                     .Build();
 
+                Logger.LogTrace("test");
+                Logger.LogCritical("test");
                 host.RunAsync(cancellationToken).GetAwaiter().GetResult();
             }
 
@@ -315,8 +329,7 @@
                 }
 
                 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
-                public void Configure(IApplicationBuilder app, IHostingEnvironment env,
-                    ILoggerFactory loggerFactory)
+                public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
                 {
                     app.UseMiddleware<THttpServerTransport>();
                 }