Skip to content
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

Add ability to silence logs or use Trace/Debug log level #92

Closed
AdamHess opened this issue Apr 22, 2021 · 2 comments
Closed

Add ability to silence logs or use Trace/Debug log level #92

AdamHess opened this issue Apr 22, 2021 · 2 comments

Comments

@AdamHess
Copy link

While I love seeing the details, my logs are getting flooded by every image Dianoga optimizes.

Unless I missed it, I would appreciate the ability to turn off logging from Dianoga.

Alternatively, you could use a lower logging level such as DEBUG since the compression status is not useful for determining the health of the application and more for debugging underlying what's going on.

@markgibbons25
Copy link
Collaborator

What would people prefer?
A separate logger for Dianoga so you can set the log level and use whatever appender you want? (use rocket emoji)
Or simply a new setting that you set the log level and it still uses the standard Sitecore logger? (use heart emoji)

@weirdpattern
Copy link

I like the idea of a separate logger for Dianoga, but for those waiting, here is an easy fix for the logs... hope this helps somebody

<?xml version="1.0"?>
<configuration>
  <sitecore>
    <log4net>
      <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender, Sitecore.Logging">
        <filter id="Dianoga Filter" type="log4net.Filter.StringMatchFilter">
          <stringToMatch value="Dianoga:" />
          <acceptOnMatch value="false" />
        </filter>
      </appender>
    </log4net>
  </sitecore>
</configuration>

You can go a little more specific if needed to by replacing "Dianoga:" with "cannot be optimized due to media type or path exclusion" or whatever other message you want to ignore.

markgibbons25 added a commit that referenced this issue Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants