This commit is contained in:
2019-01-18 18:39:24 +00:00
parent 43363e787c
commit 2b729a633f
4 changed files with 15 additions and 30 deletions

View File

@@ -28,6 +28,7 @@ namespace AyaNova.Api.Controllers
private readonly IConfiguration _configuration;
private readonly ApiServerState serverState;
private readonly IMetrics metrics;
private const int JWT_LIFETIME_DAYS=7;
/// <summary>
/// ctor
@@ -71,7 +72,7 @@ namespace AyaNova.Api.Controllers
}
int nFailedAuthDelay = 10000;
#if (DEBUG)
nFailedAuthDelay = 1;
@@ -185,7 +186,7 @@ namespace AyaNova.Api.Controllers
//create a new datetime offset of now in utc time
var iat = new DateTimeOffset(DateTime.Now.ToUniversalTime(), TimeSpan.Zero);//timespan zero means zero time off utc / specifying this is a UTC datetime
var exp = new DateTimeOffset(DateTime.Now.AddDays(30).ToUniversalTime(), TimeSpan.Zero);
var exp = new DateTimeOffset(DateTime.Now.AddDays(JWT_LIFETIME_DAYS).ToUniversalTime(), TimeSpan.Zero);
var payload = new Dictionary<string, object>()
{

View File

@@ -108,6 +108,10 @@ namespace AyaNova
var logRuleFilterOutMicrosoftEfCoreDbUpdateExceptions = new LoggingRule("Microsoft.EntityFrameworkCore.DbUpdateException", NLog.LogLevel.Trace, NLog.LogLevel.Error, nullTarget);
logRuleFilterOutMicrosoftEfCoreDbUpdateExceptions.Final = true;
//this rule is only intended to filter out this incorrect exception:
//2019-01-16 16:13:03.4808|WARN|Microsoft.EntityFrameworkCore.Query|Query: '(from Widget <generated>_4 in DbSet<Widget> select [<generated>_4]).Skip(__p_1).Take(__p_2)' uses a row limiting operation (Skip/Take) without OrderBy which may lead to unpredictable results.
var logRuleFilterOutMicrosoftEfCoreQueryExceptions = new LoggingRule("Microsoft.EntityFrameworkCore.Query", NLog.LogLevel.Trace, NLog.LogLevel.Error, nullTarget);
logRuleFilterOutMicrosoftEfCoreQueryExceptions.Final = true;
//Log all other regular items at selected level
@@ -127,6 +131,7 @@ namespace AyaNova
logConfig.LoggingRules.Add(logRuleFilterOutMicrosoftEfCoreConcurrencyExceptions);
logConfig.LoggingRules.Add(logRuleFilterOutMicrosoftEfCoreCommandExceptions);
logConfig.LoggingRules.Add(logRuleFilterOutMicrosoftEfCoreDbUpdateExceptions);
logConfig.LoggingRules.Add(logRuleFilterOutMicrosoftEfCoreQueryExceptions);
}
logConfig.LoggingRules.Add(logRuleAyaNovaItems);