1

Has anyone come across Dianoga for dotnet (v5.4.1.0) not writing to its logs under IIS? The files are created when you restart IIS but they always remain empty. This is IIS 10 on Windows Server 2016 Datacenter 10.0.14393. All worked fine under local IIS. Once deployed (to an EC2 instance on AWS) Dianoga does its thing - images are being compressed but nothing is written to the log files. The Dianoga logger uses log4net, encoded as UTF-8 (like all our other services...). Kinda stuck. Any suggestions appreciated. Other files in the logs folder are being updated, so I don't think it's a permissions thing.

My log conf is out-of-the-box:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
    <log4net>
        <appender name="DianogaFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
            <file value="$(dataFolder)/logs/Dianoga.log.{date}.txt"/>
            <appendToFile value="true"/>
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n"/>
            </layout>
            <encoding value="utf-8"/>
        </appender>
        <logger name="Dianoga" additivity="false">
            <level value="INFO" />
            <appender-ref ref="DianogaFileAppender"/>
            <!-- On Azure PaaS you may want to enable this for App Insights logging
            <appender-ref ref="AzureFallbackAppender" desc="AzureFallbackAppender" />
            -->
        </logger>
    </log4net>
</sitecore>

I think Marek's answer leans in the right direction. There's nothing in log4net.config about Dianoga... It worked locally. Is a deployed build different in this regard?

Correction - in /sitecore/admin/ShowConfig.aspx the Dianoga conf is present and correct as above...

Thanks for answers.

1
  • Can you post your log4net configuration of Dianoga log from local and AWS?
    – Marek Musielak
    Nov 4, 2021 at 13:45

2 Answers 2

0

I checked the configuration for Dianoga:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <log4net>
            <appender name="DianogaFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
                <file value="$(dataFolder)/logs/Dianoga.log.{date}.txt"/>
                <appendToFile value="true"/>
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n"/>
                </layout>
                <encoding value="utf-8"/>
            </appender>
            <logger name="Dianoga" additivity="false">
                <level value="INFO" />
                <appender-ref ref="DianogaFileAppender"/>
                <!-- On Azure PaaS you may want to enable this for App Insights logging
                <appender-ref ref="AzureFallbackAppender" desc="AzureFallbackAppender" />
                -->
            </logger>
        </log4net>
    </sitecore>
</configuration> 

Can you check if you have similar configuration ? The logs files should be : Dianoga.log.{date}.txt

0

This was casued an omission in the csproj file. We'd gone to QA with this csproj file entry:

 <None Include="App_Config\Include\Dianoga\Dianoga.Strategy.MediaCacheAsync.config.disabled" />
 <None Include="App_Config\Include\Dianoga\Dianoga.Strategy.GetMediaStreamSync.config" />

So neither async nor sync processing is being added to the media stream.

Since we're runing in synchronous mode, we just changed it to:

 <None Include="App_Config\Include\Dianoga\Dianoga.Strategy.MediaCacheAsync.config.disabled" />
 <Content Include="App_Config\Include\Dianoga\Dianoga.Strategy.GetMediaStreamSync.config" />

And it all burst into life.

Thanks for suggestions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.