I've got an existing Class Library with a lot of functionality and business logic, that I'm trying to integrate with a clean install of Umbraco 6.0.
Unfortunately, some of the external dlls that we're using are relying on log4net version 1.2.10.0 and Umbraco 6.0 uses log4net version 1.2.11.0...
I tried the simple fix of replacing the dlls. When replacing the log4net.dll in the Umbraco/bin dir with the old version, we get this error when starting up the website:
"Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies."
When using the new version of log4net Umbraco works, but the page calling a method in our class library will fail with:
"Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=be58efc3b934219b' or one of its dependencies."
Did you add the 1.2.11.0 log4net as a reference in your project and recompile it afterwards? We've been doing this on projects where we have been using an older version of the log4net.dll file, which worked fine.
No, I added Umbraco to my project using the package manager console. So I guess it's the binary distribution, and my feeble attempts at adding references to different versions of log4net have not been compiled into the project...
A pointer to how to get a compileable version and build it? :)
I tried adding log4net 1.2.10 to my Umbraco project and compile it. The result is that Umbraco will not start because it cannot find log4net 1.2.11.
An important point: In my class library we're using a third party component that is using 1.2.10, so I have no way of recompiling that to use 1.2.11 -- we're stuck with 1.2.10 :(
Is there no way to have both versions exist in the same project?
The solution I linked to in the very first entry in this thread actually worked. I just couldn't see it, as I was fooled by Apache changing its public key token on the DLLs, which gives the same error message...
Was having the same problem with Log4Net and finally found the cause. In my project downloaded Log4Net from the Apache site (http://logging.apache.org/log4net/) and copied the log4Net.DLL in folder log4net-1.2.11-bin-newkey\log4net-1.2.11\bin\net\4.0\release. This DLL is the same version 1.2.11.0 but noticed has different file size to the one that comes with Umbraco 6 installation.
Solution, instead using the one from the Apache site, went back to use the one in Umbraco and problem solved.
Don't understand why the DLLs are different being 1.2.11 and both NET Framework 4.0. Any ideas?
I'm experiencing the same issue. I have a domain project which relies on Castle Windsor to inject the log4net facility into my code and this relies on log4net 1.2.10 but Umbraco is using, what seems to be a patched version of 1.2.11.
Can any of the Umbraco experts shed some light why Umbraco has a patched version of log4net?
So far I've tried:
Redirecting all assemblies to 1.2.11 from Umbraco installation but it won't work as the patched version has a null public key token Forking castle core log4net integration to use the umbraco patched log4net assembly which won't build as it doesnt have a Strong Name
I am not an expert but it may be that the log4net version Umbraco is using has some customizations like a Medium trust. I would be interested in hearing from some experts on this as well.
<!--To Change the way logging works for certain namespaces, insert a new logger like: --> <!-- <logger name="Umbraco.Core"> <level value="WARN" /> </logger>-->
Problems with different versions of log4net
Hello,
I've got an existing Class Library with a lot of functionality and business logic, that I'm trying to integrate with a clean install of Umbraco 6.0.
Unfortunately, some of the external dlls that we're using are relying on log4net version 1.2.10.0 and Umbraco 6.0 uses log4net version 1.2.11.0...
I tried the simple fix of replacing the dlls. When replacing the log4net.dll in the Umbraco/bin dir with the old version, we get this error when starting up the website:
"Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies."
When using the new version of log4net Umbraco works, but the page calling a method in our class library will fail with:
"Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=be58efc3b934219b' or one of its dependencies."
I've tried this solution: http://stackoverflow.com/questions/2460542/using-different-versions-of-the-same-assembly-in-the-same-folder
But for some reason this doesn't work for me. Is there another way of doing the same when running a website or am I missing something?
Does anybody have any tips on this or have had a similar problem?
Thanks,
Mikkel
Hi Mikkel and welcome to our :)
Did you add the 1.2.11.0 log4net as a reference in your project and recompile it afterwards? We've been doing this on projects where we have been using an older version of the log4net.dll file, which worked fine.
Looking forward to hearing from you.
/Jan
Hi Jan,
Thanks for your answer :)
No, I added Umbraco to my project using the package manager console. So I guess it's the binary distribution, and my feeble attempts at adding references to different versions of log4net have not been compiled into the project...
A pointer to how to get a compileable version and build it? :)
Thanks,
Mikkel
OK a quick follow up:
I tried adding log4net 1.2.10 to my Umbraco project and compile it. The result is that Umbraco will not start because it cannot find log4net 1.2.11.
An important point: In my class library we're using a third party component that is using 1.2.10, so I have no way of recompiling that to use 1.2.11 -- we're stuck with 1.2.10 :(
Is there no way to have both versions exist in the same project?
Thanks,
Mikkel
Final follow up :o)
The solution I linked to in the very first entry in this thread actually worked. I just couldn't see it, as I was fooled by Apache changing its public key token on the DLLs, which gives the same error message...
Was having the same problem with Log4Net and finally found the cause. In my project downloaded Log4Net from the Apache site (http://logging.apache.org/log4net/) and copied the log4Net.DLL in folder log4net-1.2.11-bin-newkey\log4net-1.2.11\bin\net\4.0\release. This DLL is the same version 1.2.11.0 but noticed has different file size to the one that comes with Umbraco 6 installation.
Solution, instead using the one from the Apache site, went back to use the one in Umbraco and problem solved.
Don't understand why the DLLs are different being 1.2.11 and both NET Framework 4.0. Any ideas?
While I struggled with this problem, I found this page:
http://stackoverflow.com/questions/8743992/how-do-i-work-around-log4net-keeping-changing-publickeytoken
I don't know if it gives any clear answers to why Apache decided to change the publickeytoken, but it's the best I could find :o)
Thanks for the reply. Did not find any reference to the log4Net publicKeyToken in Umbraco thats why did not try with the old key DLL.
But it is curious that Umbraco log4Net.dll is 252KB and the one from Apache is 282KB.
We'll need to wait for the good Umbraco people to compile with the DLL with the new key.
Hi Guys,
I'm experiencing the same issue. I have a domain project which relies on Castle Windsor to inject the log4net facility into my code and this relies on log4net 1.2.10 but Umbraco is using, what seems to be a patched version of 1.2.11.
Can any of the Umbraco experts shed some light why Umbraco has a patched version of log4net?
So far I've tried:
Redirecting all assemblies to 1.2.11 from Umbraco installation but it won't work as the patched version has a null public key token
Forking castle core log4net integration to use the umbraco patched log4net assembly which won't build as it doesnt have a Strong Name
Does anyone have any other ideas?
I am not an expert but it may be that the log4net version Umbraco is using has some customizations like a Medium trust. I would be interested in hearing from some experts on this as well.
Thanks Jerode,
For now I've managed to get things working by adding a code base redirect to the web.config for Castle Windsor log4net integration to work:
And then adding a second appender in the log4net.config file which logs all the custom code:
Now I can use the Castle.Core.Logging facility feature and install it as follows:
How I solved.
Did 3 things:
Removed all instances of Log4net from all projects (MVC and class libraries) and copy one comes with UmbracoCMS installation.
Removed all temp files in all projects
Removed previous references of all other class libraries which were using Log4net, built them again and then added references into web project.
is working on a reply...