-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
${aspnet-request-posted-body} produces empty log #583
Comments
The documentation says that you need to specify what part of the AspNet-Request-HttpContext that you want to output (cookie, header, item, form, queryString): https://github.com/NLog/NLog/wiki/AspNetRequest-layout-renderer You will also notice that for ASP.NET Core, then it has been split into several layoutrenderers. Maybe try this instead:
See also: https://github.com/NLog/NLog/wiki/AspNetRequest-Url-Layout-Renderer |
Thank you! But now I'm trying to use |
Sounds like a different issue. Maybe duplicate of #556 |
I saw this issue, trying to work on a workaround since in my case it is Framework 4.5 and not Core |
@Tabgyn Have you checked the NLog InternalLogger ? https://github.com/NLog/NLog/wiki/Logging-troubleshooting |
Yes <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwConfigExceptions="true"
internalLogFile="c:\log.txt" internalLogLevel="Trace">
... I don't see errors |
Guess you have to start debugging, and figure out why NLog fails to extract anything from InputStream: NLog.Web/src/Shared/LayoutRenderers/AspNetRequestPostedBody.cs Lines 136 to 144 in 14ea99e
|
Thanks to @bakgerman now NLog.Web.AspNetCore v5.1 re-introduces ${aspnet-request-posted-body} with help from middleware: app.UseMiddleware<NLog.Web.NLogRequestPostedBodyMiddleware>(); It is no longer necessary to explicit call |
Type:
NLog version: 4.7.2
NLog.Web version: 4.9.2
Platform: .Net 4.5
Current NLog config
C# Controller
What is the current result?
${aspnet-request} logs nothing
What is the expected result?
Request to be logged
Did you checked the Internal log?
Yes. The internal log does not have errors.
Please post full exception details (message, stacktrace, inner exceptions)
No
The text was updated successfully, but these errors were encountered: