<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: vb.net arcgis add in, log4net does not work by installing esriAddIn in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229580#M5977</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robby,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally make it work. What I do is modifying the AssemblyInfo.vb, and hard code the setting of log4net.Config.XMLConfigurator (configFile). Later I will try to find a proper way to set it (instead of hard coding).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jun 2014 02:33:43 GMT</pubDate>
    <dc:creator>LiYao</dc:creator>
    <dc:date>2014-06-25T02:33:43Z</dc:date>
    <item>
      <title>vb.net arcgis add in, log4net does not work by installing esriAddIn</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229577#M5974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to use log4net in my vb.net for ArcGIS add-in. After I build the solution, it generates a .exe file and a .esriAddIn file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is when I run the .exe file (without open ArcMap), the log4net works, but when I install the .esriAddIn in ArcMap, and call a form from ArcMap, the log4net doesn't work at all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I check from internet but most of the answers are talking about c#.net, this problem call me crazy, anybody has the experience of using log4net in vb.net ArcGIS add in? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help will be appreciated. thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 05:53:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229577#M5974</guid>
      <dc:creator>LiYao</dc:creator>
      <dc:date>2014-06-24T05:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: vb.net arcgis add in, log4net does not work by installing esriAddIn</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229578#M5975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well first off, if your project is compiling an exe file when you build your addin, then you have your build settings wrong. It should be compiling to a dll file, which is then included in the esriaddin file. Next, take the generated esriaddin file and change its extension to zip. Then look in that zip file and go to the Install folder and make sure that the log4net dll and xml files are there. If that's all good, take a look at the code that I have for a vb.net addin that uses log4net.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
'This is the function I call when I need to get the ILog object for logging
Dim m_blnLogConfigured As Boolean
Public Function GetConfiguredLog(ByVal LoggerName As System.Type) As log4net.ILog
&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not m_blnLogConfigured Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_blnLogConfigured = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log4net.Util.LogLog.InternalDebugging = System.Diagnostics.Debugger.IsAttached
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim AssemblyLocation As String = System.Reflection.Assembly.GetExecutingAssembly.Location
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim ConfigFilePath As String = IO.Path.Combine(IO.Path.GetDirectoryName(AssemblyLocation), "log4net.xml")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log4net.Config.XmlConfigurator.Configure(New IO.FileInfo(ConfigFilePath))
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp; Return log4net.LogManager.GetLogger(LoggerName)
End Function
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[HTML]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;!-- This is the log4net.xml file that configures it for my addin --&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;log4net&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;appender name="RollingFile" type="log4net.Appender.RollingFileAppender"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;file value="MyApplicationLog.log" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;appendToFile value="true" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;maximumFileSize value="1024KB" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;maxSizeRollBackups value="10" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;layout type="log4net.Layout.PatternLayout"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;conversionPattern value="%date %level %logger - %message%newline" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/layout&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;/appender&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;root&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;level value="ALL" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;appender-ref ref="RollingFile" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;/root&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/log4net&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/HTML]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And I can confirm that this works without a problem. It creates the log file in C:\Program Files (x86)\ArcGIS\Desktop10.1\bin\MyApplicationLog.log, which may be a problem if you aren't running ArcMap as an administrator. I'll have to check and see if there's a way to tell it to put it somewhere else.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;NOTE: I just looked at the version I have (1.2.10) and the release notes (&lt;/SPAN&gt;&lt;A href="http://logging.apache.org/log4net/release/release-notes.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://logging.apache.org/log4net/release/release-notes.html&lt;/A&gt;&lt;SPAN&gt;) and found that there appear to have been some significant changes since the version that I've been using. So keep that in mind. I'm going to add it to my todo list for this project to look into updating log4net. If I find that there are significant changes that need to be made, I'll post back here to let everyone know. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:09:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229578#M5975</guid>
      <dc:creator>RobertMaddox</dc:creator>
      <dc:date>2021-12-11T11:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: vb.net arcgis add in, log4net does not work by installing esriAddIn</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229579#M5976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi robby,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your detailed answer. I have successfully set the build to dll instead of exe and check the requirements you mentioned. But I still cannot get the log4net work. I am using log4net 1.2.10 and follow the link here : &lt;/SPAN&gt;&lt;A href="http://www.codeproject.com/Articles/42276/How-to-Use-Log-Net-with-VB-NET-A-Simple-Step-By-St"&gt;http://www.codeproject.com/Articles/42276/How-to-Use-Log-Net-with-VB-NET-A-Simple-Step-By-St&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 02:13:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229579#M5976</guid>
      <dc:creator>LiYao</dc:creator>
      <dc:date>2014-06-25T02:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: vb.net arcgis add in, log4net does not work by installing esriAddIn</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229580#M5977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robby,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally make it work. What I do is modifying the AssemblyInfo.vb, and hard code the setting of log4net.Config.XMLConfigurator (configFile). Later I will try to find a proper way to set it (instead of hard coding).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 02:33:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-arcgis-add-in-log4net-does-not-work-by/m-p/229580#M5977</guid>
      <dc:creator>LiYao</dc:creator>
      <dc:date>2014-06-25T02:33:43Z</dc:date>
    </item>
  </channel>
</rss>

