6

I've created this patch file for a Sitecore 9 instance, but looking at showconfig.aspx it has had no effect. The config file name begins with a 'z' to try to ensure it's processed last.

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <log4net>
      <root>
        <priority value="ERROR" />
      </root>
      <logger name="Sitecore.Diagnostics.WebDAV" additivity="false">
        <level value="ERROR"/>
      </logger>
      <logger name="Sitecore.Diagnostics.Publishing" additivity="false">
        <level value="ERROR"/>
      </logger>
    </log4net>
  </sitecore>
</configuration>

Is it possible to patch in log4net config settings? If so, is my config file formatted incorrectly?

1 Answer 1

12

You forgot to use patch:attribute syntax. Valid patch file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <log4net>
      <root>
        <priority>
            <patch:attribute name="value">ERROR</patch:attribute>
        </priority>
      </root>
      <logger name="Sitecore.Diagnostics.WebDAV" additivity="false">
        <level>
            <patch:attribute name="value">ERROR</patch:attribute>
        </level>
      </logger>
      <logger name="Sitecore.Diagnostics.Publishing" additivity="false">
        <level>
            <patch:attribute name="value">ERROR</patch:attribute>
        </level>
      </logger>
    </log4net>
  </sitecore>
</configuration>
1
  • Thanks for this Marek, I had forgotten about the patch:attribute syntax. Now working well! Commented Nov 14, 2019 at 15:47

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.