WPF-Log4Net used inside VSIX extension did not output log when installed at target VS

前端 未结 1 1126
礼貌的吻别
礼貌的吻别 2021-01-26 06:58

Log4net doesn\'t log when it is used inside a VSIX extension and installed at another target VS.

I have a WPF solution. I downloaded log4net dll, I added log4net.config

相关标签:
1条回答
  • 2021-01-26 07:51

    After analyzation the problem was that log4net did not log when used inside a visual studio extension.

    The solution was described in this so post

    As written by Gifty in the comment:

    Thank you. XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));

    This line was taking my local solution path for log4net instead of the extension installed path so I changed that line to var log4netconfigpath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\log4net.config";

    and changed the log4net.config file properties BuildAction-Content and Include in VSIX-true now its working as expected. Thank you dsdel for redirecting me to that post :)

    0 讨论(0)
提交回复
热议问题