2

I am writing my custom ECL connector but cannot get it to log my own logging statements using log4net. I placed my App.config file including log4net config next to my ECL DLL, log4net has been added to the GAC, but no luck so far. Anyone got this working or would know a way to troubleshoot?

| improve this question | | | | |
  • Have you added logging to your "ExternalContentLibrary.xml" as per docs.sdl.com/LiveContent/content/en-US/SDL_ECLMediaManager_11/… (points 1 and 2)? – Shiva Mar 1 '16 at 15:01
  • 1
    I assume you did make sure the app.config was renamed to match the DLL name in the build folder? I am not 100% sure VS does that for you when it is a DLL, not an EXE you are building. You should not need to add assemblies to the GAC, just include them in the folder of the provider. – Lars Møllebjerg Mar 1 '16 at 15:55
  • Have you checked logging level that you have set for log4net and what statements you are writing? Like if loglevel is error then debug statements will not logged. – Hiren Kaku Mar 1 '16 at 20:58
  • 1
    Thanks everyone for the help. In the end I got it working by using ILMerge to include log4net (and Newtonsoft JSON) when building the ECL connector DLL. I also renamed my App.config to the DLL name + .config. – Para Jaco Mar 2 '16 at 7:53
  • Renaming the config file is required. Using ILMerge is not. If the required assemblies are present in the provider folder, they will get loaded. Newtonsoft can normally be very problematic as it does not follow .NET versioning guidelines, but as the ECL providers are isolated in application domains you will not get a conflict with other versions of newtonsoft used elsewhere. – Lars Møllebjerg Mar 2 '16 at 9:07
1

App.config must be renamed to match the name of the primary DLL of the Provider - the DLL where you implement IContentLibrary.

Next to this ensure all assemblies required for log4net are included in the folder containing the primary DLL. Alternatively you can use the GAC, but typically this is not required so to simplify deployment I would recommend against it.

Specifically you should not place NewtonSoft.JSON in the GAC as it does not follow .NET versioning standards. Placing Newtonsoft.JSON in the GAC can break completely unrelated applications on your system.

And always consider if you can simply use IHostServices.LogMessage.

| improve this answer | | | | |

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.