Getting log4net Errors When Attempting to Browse Sitecore Pages
Getting log4net Errors When Attempting to Browse Sitecore Pages
Description
The log4net.dll
file in the <SITECORE_INSTANCE_ROOT>\website\bin
folder was changed and you’re now seeing errors like the following when attempting to browse your Sitecore pages:
Could not load file or assembly 'log4net, Version=1.2.11.0, culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a or one of its dependencies. The located assembly's manifest definition doesn't match the assembly reference…
Explanation
Coveo for Sitecore uses its own version of log4net.dll
. This custom version of log4net.dll
is 1.2.11.0.
The Coveo for Sitecore version of the log4net.dll
needs to be in the bin
folder of your website in order for it to work properly.
Whenever you’re installing a Coveo for Sitecore package, it will automatically overwrite any version of log4net.dll
in [YourSitecoreInstance\website\bin
.
Environment
-
Coveo for Sitecore 863+
-
Error Message
-
Log4Net
Resolution
If you’re planning on using a log4net.dll
file other than the Coveo for Sitecore custom version, you need to install that dll in a folder other than bin
.
Therefore, you need to create a separate folder for your version of log4net.dll
and explicitly tell Sitecore where to get it:
-
In the
<SITECORE_INSTANCE_ROOT>\website
directory, create a folder namedlog4netCustom
. So the path to this folder will be<SITECORE_INSTANCE_ROOT>\website\log4netCustom
. -
Move your
log4net.dll
(1.2.XX.0) file into thelog4netCustom
folder. -
Open the Sitecore
web.config
file. -
Locate the
assemblyBinding
element. -
Insert the following XML snippet inside the
assemblyBinding
element.<dependentAssembly> <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" /> <codeBase version="1.2.XX.0" href="log4netCustom\log4net.dll" /> </dependentAssembly>