Git Product home page Git Product logo

aspnetcore.serilog.requestloggingmiddleware's People

Contributors

mthamil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

aspnetcore.serilog.requestloggingmiddleware's Issues

I need a way to configure message template

Currently messagetemplate is hardcoded

private const string MessageTemplate = "HTTP {Method} to '{Path}' responded with {StatusCode} in {Elapsed:0.0000} ms";

Changing this would enable localization and more customization.
For example, using {Elapsed:0.00} ms instead of {Elapsed:0.0000} ms would be useful as it's less noisy IMHO

Usage?

Just wondering how I'd would use this. Thanks!

Logging Enriched Properties

I added a LogContext property, CorrelationId, which am able to log using the output template:

"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} | {Level:u3} | {CorrelationId} | {Message:lj}{NewLine}{Exception}"

Most of the log lines show the CorrelationId. e.

2021-05-20 10:18:19.971 | INF | CID: 12345C12 | Executed endpoint ...
2021-05-20 10:18:19.975 | INF | CID: 12345C12 | HTTP GET /api/v1/model/search?...responded 200 in 2396.5086 ms
2021-05-20 10:18:19.977 | DBG | CID: 12345C12 | [Response]: 200: {...}

The summary line from this middleware does not log the CorrelationId

2021-05-20 10:18:19.981 | INF | | Request finished in 2411.9684ms 200 application/json; charset=utf-8

Is there a way for this Middleware to log this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.