-
Notifications
You must be signed in to change notification settings - Fork 45
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
Optimization errors do not contain the media path in the logs #91
Comments
Issue is with OptimizerProcessor.cs in Process method. It's catch section contains below (I validated the issue) Log.Error($"Dianoga: Unable to optimize due to a processing error! It will be unchanged.", ex, this); In version 4.0 this logging was not there but in version 5.3.0 it is there. |
If you comment the log at line around 48 in OptimizerProcessor.cs in Process method, you will get an error like below. (which is similar like version 4.0) 21896 14:48:29 INFO Dianoga: optimized /Default Website/sc_logo.png [original size: 4081 bytes] [final size: 3235 bytes] [saved 846 bytes / 20.73%] [Optimized in 201ms] [Extension png] OR |
@SudhirKumar2254 Thanks for the response. In the first option, those INFO-level logs are what I see when the optimization works. I don't think those would help point out the cases where optimization doesn't work. I think the second option of keeping the log statement would be better. It also gives the flexibility of changing the logging level to "WARN" or higher and still being able to see which images aren't getting optimized. Maybe the media path can be passed through OptimizerArgs so it can be used in the log statement in OptimizerProcessor.cs? Looks like this could be passed from ExtensionBasedOptimizer.cs since it has |
@AustinHinckley - Thanks for your response. I have done the code changes to log Media Path. |
@SudhirKumar2254 open a PR? |
Optimization errors do not contain the media path in the logs kamsar#91
|
Thanks @SudhirKumar2254 ! Merged and released. |
Welcome. @markgibbons25 Any other issue I can help with? |
@markgibbons25 @SudhirKumar2254 Thank you both! |
Version of Dianoga
5.3.0
Environment description
Sitecore 9.3 - local single instance as well as environments with one CM and multiple CD servers.
What configs you have enabled
Reproducible steps (1... 2... 3...) that cause the issue
Cause image optimization to throw an exception. Here is one way to do this:
What you expected to see, versus what you actually saw
Expected: The logs should contain the error message from the optimization as well as the image's path in the media library, or at least something to identify which image produced an error.
Observed: The logs contain the error message, but the message does not contain any information that can help identify the image (such as the media path). It does have the temp file path, but that file gets deleted.
Some more context: We recently upgraded from version 4.0.0 to version 5.3.0 so that if exceptions occur, the original image is served instead of no image, as mentioned here: #68
However, after the upgrade, we noticed that the error messages in the logs no longer contain the media path. So if we ever need to identify which images aren't being optimized (or have to troubleshoot issues with images in production), we could no longer do so by viewing the logs.
Relevant logs
Version 5.3.0 (image path missing)
Version 4.0.0, which had the image path:
The text was updated successfully, but these errors were encountered: