0

I would like to implement custom logging in my sc8.2u4 instance. The patch config has this code. When I browse CMS it gives the error -

Could not find configuration node: watchers/media/folder

I did not add any settings in the web.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <log4net>
      <appender name="MySiteCustomLoggerAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
        <file value="$(dataFolder)/logs/MySite.{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="MySite.Foundation.Common.Utilities.BBLCustomLogger" additivity="false">
        <level value="INFO"/> 
        <appender-ref ref="MySiteCustomLoggerAppender"/>              
      </logger> 
    </log4net> 
  </sitecore>
</configuration>

For another instance which had sc8.0, I added the appender & logger settings in web.config. But for 8.2, we can do it from the patch configs. Is that correct?

  • I tried your configuration on a "blank" Sitecore instance (Sitecore 8.2 Update 4) and it works fine. I don't get any error browsing the CMS. Also, when I check /sitecore/admin/ShowConfig.aspx, the logger is added correctly. Did you change anything else, that could cause this error? – n-develop Aug 28 '17 at 6:20
  • If you have copy paste the above in your config file from the internet, it may be the encoding is different. Try to type it manually and see if it works – Hishaam Namooya Aug 28 '17 at 7:15
4

You are correct in that you can patch in log4net settings in recent Sitecore releases.

But your patch file is unrelated to your error, as Zach already pointed out.

My guess; given that the missing config lies right above log4net - you removed this by mistake earlier. Sitecore.config needs to look like this.

  <watchers>
    <media>
      <folder ref="settings/setting[@name='MediaFolder']/@value">
      </folder>
      <filter>*</filter>
    </media>
    <xsl>
      <folder>/</folder>
      <filter>*.xslt</filter>
    </xsl>
    <layout>
      <folder ref="settings/setting[@name='LayoutFolder']/@value" />
      <filter>*</filter>
    </layout>
    <config>
      <folder>/App_Config</folder>
      <filter>*.config</filter>
    </config>
  </watchers>

enter image description here

  • Hi Mark. I only created a patch config and did not edit any other configs in the instance. My config code is exactly as in Question. When I delete the config, the site loads fine and in the showconfig.aspx, I see the <watchers> node. Is My config removing those watcher nodes? – Qwerty Sep 8 '17 at 8:31
3

The configuration error that you're reporting looks unrelated to your patch config. The watchers/media/folder node should be defined in your App_Config/Sitecore.config file by default. Open up that file and make sure that the node is in there. Since the path watchers/media/folder is XPath, you're going to need to look for a structure similar to the following:

<watchers>
  <media>
    <folder>
      ...
    </folder>
  </media>
<watchers>

If this structure is found in your Sitecore.config and you don't see anything wrong with it (missing/mismatched closings, syntax errors, etc.) then first try removing all of your other custom patch configs and see if the error is fixed. If so, add them back one-by-one to identify the patch that is breaking your solution. If not, try replacing your Sitecore.config with one from a clean download of Sitecore 8.2 update 4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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