I'm building a Windows Service in VB.NET with Visual Studio 2012. I included log4net in my project to deal with logging information about the service execution. I created a log4net.config
file, which I marked Copy if newer
in its Copy to Output Directory
property.
I added an Installshield LE Setup project to my solution, and selected Myproject.Primary Output
in the files to include. I expected my log4net.config
file to be included in the setup since it's marked to be copied in output, but when I actually install it, it is not included. I already did research and found that I can turn the Build Action
to Content
for log4net.config and then also include Myproject.Content Files
in my Setup Project. It turns out it works.
However, after reading this answer on SO, I noticed that Build Action->Content is used to get files as streams, which is not really what I wanted to achieve with it
I would like to know if there is an other way, a recommended way to include my log4net.config file from the build into my Installshield Setup project ?
How about adding loggly related configuration in App.config file like below. I am using it for hosting WCF service within Window Service and it works fine for me.
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="LogglyAppender" />
</root>
<appender name="LogglyAppender" type="log4net.loggly.LogglyAppender, log4net-loggly">
<rootUrl value="https://logs-01.loggly.com/" />
<inputKey value="abcdefgh" />
<tag value="log4net" />
</appender>
</log4net>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With