Singleton Theory Components - SingletonTheory/SingletonTheory.github.io GitHub Wiki
- Unzip MongoDB to the folder of choice.
- Open the folder
- Create a Data folder
- Create a batch file with the following command in it:
bin\mongod.exe --dbpath <DataFolder>
- Replace with your chosen Data folder name from step 3
- Run batch file.
Every API needs logs to be written and this means that a few decisions needs to be made. Decisions that could potentially make it difficult to change providers later on. In the Services our Logger need to be easily switchable and to enable this ServiceStack has a way of separating your Logging provider from your implementation by way of the LogManager. ServiceStack also makes a ditinction between two types of logging as defined in the following section.
Inline logging is enabled by way of the LogManager which is hooked up in the AppHost. This allows you to enable the logging provider of your choice as defined in their documentation. Currently the following providers are supported:
- NLog
- Elmah
- Log4Net
- Log4Netv129
- EventLog
- EnterpriseLibrary
Our choice at this stage is Log4Net seeing that it is currently the standard in the .Net community.
The RequestLogger logs all requests and responses by way of the IRequestLogger. ServiceStack has a built-in provider [RequestLogsFeature] for this and allows your hook your own up by way of implementing the interface. This is injected by using the Plugins library of ServiceStack as defined in their documentation.
Once the Requst Logs are configured they can be viewed at the following routes: [api/requestlogs]
https://github.com/ServiceStack/ServiceStack.Logging
By enabling profiling we have a chance to view our api requests and long they take. To do this the following lines was added to the Global.asax:
protected void Application_BeginRequest(object src, EventArgs e)
{
if (Request.IsLocal)
Profiler.Start();
}
protected void Application_EndRequest(object src, EventArgs e)
{
Profiler.Stop();
}
For further information I would recommend the following: