My question is somehow related to this question, but it is a different issue.

I have used log4net in an Event DLL; I have written custom events for publish and save events, but I don't get logs for both, only one of them works, depending on how I install log4net.dll. In development server, I get logs for Publish events if I register log4net using gacutil, or logs for Save events if I drag and drop the dll to Windows\assembly folder, but never both of them.

In production server, I only get logs for publish events, no matter what I do.

Save event logs are far more important for the user to be stored, so production is working the wrong way. Ideal case would be having both logs, but having only save logs would be ok.

I guess it has something to do with .NET Framework versions and GAC but I don't really get how it works. Can anyone help or point me in the right direction?

Thank you.

  • Which version (or location) of gacutil are you using to register the DLL? See also stackoverflow.com/questions/6507675/gac-32bit-vs-64bit for the different locations of the GAC assemblies Feb 22 '13 at 8:30
  • in DEV version 4.0; in PROD version 3.5 Feb 22 '13 at 8:33
  • I guess the real question here is how to know what GAC is being used by Tridion processes? Feb 22 '13 at 8:45
  • 1
    I would think its always the 4.0 one, as that is what Tridion is configured to use. 3.5 will use the c:\windows\assembly folder and 4.0 the c:\windows\Microsoft.NET\assembly\GAC_MSIL I believe. But whenever I install an assembly in the GAC on a Tridion 2011 server, I use the c:\windows\Microsoft.NET\assembly\GAC_MSIL folder (or the 4.0 gacutil). One thing to remark is that save uses the COM+ and Publish uses .Net 4.0 code, so maybe yo actually need both (if possible at all). Feb 22 '13 at 9:20

Bart's comment made me think about two processes trying to use the dll, and that made me think about two processes trying to write the same log file. So that seems to be the real problem, not GAC versions but two processes trying to write the same log file; I used two different log files for Save and Publish events and then I got both log files.

I still haven't tested in PROD but it works fine in DEV.

Thank you!

UPDATED: As Nuno pointed, there is a log4net configuration that allows both processes to use the same log file:

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

I saw it in StackOverflow.

  • 3
    Glad you found it. I suppose there is a way in log4net to allow for this (probably something around "soft locks"), but if this solution works for you, then great!
    – Nuno Linhares
    Feb 22 '13 at 13:38
  • 1
    It works but this one works much better! Thank you Nuno!! Feb 22 '13 at 14:00

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.