Add logging.
This commit is contained in:
14
Program.cs
14
Program.cs
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.SelfHost;
|
||||
using MarketData;
|
||||
using MarketData.Utils;
|
||||
using MarketDataServer.Authorization;
|
||||
using MarketDataServer.Handlers;
|
||||
|
||||
@@ -17,6 +16,11 @@ namespace MarketDataServer
|
||||
static readonly Uri _baseAddress = new Uri("http://localhost:8000/");
|
||||
static void Main(string[] args)
|
||||
{
|
||||
MDTrace.LogLevel = LogLevel.DEBUG;
|
||||
String strLogFile = "marketdataserver.log";
|
||||
Utility.DeleteFile(strLogFile);
|
||||
Trace.Listeners.Add(new TextWriterTraceListener(strLogFile));
|
||||
|
||||
Authorizations.GetInstance().IsEnabled = true;
|
||||
// Set up server configuration
|
||||
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(_baseAddress);
|
||||
@@ -26,7 +30,7 @@ namespace MarketDataServer
|
||||
var server = new HttpSelfHostServer(config);
|
||||
// Start listening
|
||||
server.OpenAsync().Wait();
|
||||
Console.WriteLine("Web API Self hosted on " + _baseAddress + " Hit ENTER to exit...");
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Web API Self hosted on {_baseAddress} Hit ENTER to exit...");
|
||||
Console.ReadLine();
|
||||
server.CloseAsync().Wait();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user