Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Damiano Piva 5 posts 85 karma points
    Mar 08, 2023 @ 08:50
    Damiano Piva
    0

    How to disable Sending image log

    I have an umbraco installation with Serilog MinimumLevel Information. I want remove all the "ImageSharp" logs with the @MessageTemplate "Sending image. Request uri: '{Uri}'. Cached Key: '{Key}'" How can i do it?

    Thanks a lot

    Damiano

  • Richard Ockerby 35 posts 210 karma points MVP 4x c-trib
    Apr 04, 2023 @ 16:47
    Richard Ockerby
    105

    You can acheive this by changing the Serilog log level in the appsettings.json. The log you're talking about is set to severity Information so you need to be at Warning or higher to not show it.

    You can either change the Default in the MinimumLevel which will change for all your loggers, or you can specify it in the Override property, as shown below:

    {
      ...
      "Serilog": {
        "MinimumLevel": {
          "Default": "Information",
          "Override": {
            ...
            "SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware": "Warning"
          }
        }
      },
      ...
    }
    
  • Damiano Piva 5 posts 85 karma points
    Apr 05, 2023 @ 07:03
    Damiano Piva
    0

    Thank you!!!

    that work like a charm

  • Murray Roke 503 posts 966 karma points c-trib
    Nov 08, 2023 @ 23:10
    Murray Roke
    0

    This will remove all the "information" level logs. I wonder if this log should be debug level it's really noisy.

  • Richard Ockerby 35 posts 210 karma points MVP 4x c-trib
    Nov 08, 2023 @ 23:31
    Richard Ockerby
    0

    I tend to agree - all that noise isn't really "information", more "debug". If we didn't have the power to deactivate I would probably have raised an issue.

    However, if you feel this is something that should be changed, reach out to ImageSharp - the exact thing you're looking for is https://github.com/SixLabors/ImageSharp.Web/blob/main/src/ImageSharp.Web/Middleware/LoggerExtensions.cs#L34

  • Murray Roke 503 posts 966 karma points c-trib
    Apr 10, 2024 @ 01:19
    Murray Roke
    0

    I also didn't read your solution closely enough I see that I can set the log level to warning for just the Imagesharp namespace!

  • Thomsen 113 posts 336 karma points
    Sep 04, 2024 @ 14:03
    Thomsen
    0

    For anyone still annoyed by the noisyness of the ImageSharp cluttering up the Information log, I had it completely removed by this Serilog configuration:

      "Serilog": {
        "MinimumLevel": {
          "Default": "Information",
          "Override": {
            "Microsoft": "Warning",
            "Microsoft.Hosting.Lifetime": "Information",
            "System": "Warning",
            "SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware": "Warning"
          }
        },
        "Filter": [
          {
            "Name": "ByExcluding",
            "Args": {
              "expression": "SourceContext = 'SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware'"
            }
          }
        ]
      }  
    
  • Richard Ockerby 35 posts 210 karma points MVP 4x c-trib
    Sep 04, 2024 @ 14:51
    Richard Ockerby
    0

    That’ll definitely do it, but might make debugging a bit hard if something does go wrong. Setting the level to Fatal or Error may work to remove all the clutter.

    All the options for Serilog are mentioned https://github.com/serilog/serilog/wiki/Configuration-Basics#minimum-level

Please Sign in or register to post replies

Write your reply to:

Draft