From 3bfe5fd00e31cb08162fb52b3c2ec3df7cb083a6 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 1 Feb 2021 20:31:24 +0100 Subject: [PATCH] Added some logging when app returns 404. --- backend/src/Squidex.Web/Pipeline/AppResolver.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backend/src/Squidex.Web/Pipeline/AppResolver.cs b/backend/src/Squidex.Web/Pipeline/AppResolver.cs index 16f61412b..3ab09742f 100644 --- a/backend/src/Squidex.Web/Pipeline/AppResolver.cs +++ b/backend/src/Squidex.Web/Pipeline/AppResolver.cs @@ -13,10 +13,12 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.DependencyInjection; using Squidex.Domain.Apps.Entities; using Squidex.Domain.Apps.Entities.Apps; using Squidex.Infrastructure; using Squidex.Infrastructure.Security; +using Squidex.Log; using Squidex.Shared; using Squidex.Shared.Identity; @@ -47,6 +49,13 @@ namespace Squidex.Web.Pipeline if (app == null) { + var log = context.HttpContext.RequestServices?.GetService(); + + log?.LogWarning(w => w + .WriteProperty("message", "Cannot find app with the given name.") + .WriteProperty("appId", "404") + .WriteProperty("appName", appName)); + context.Result = new NotFoundResult(); return; } @@ -88,6 +97,13 @@ namespace Squidex.Web.Pipeline } else { + var log = context.HttpContext.RequestServices?.GetService(); + + log?.LogWarning(w => w + .WriteProperty("message", "Authenticated user has no permission to access the app.") + .WriteProperty("appId", app.Id.ToString()) + .WriteProperty("appName", appName)); + context.Result = new NotFoundResult(); }