I have a very simple Windows service developed using TopShelf. I'm using log4net and have a UDP Appender configured. I'm using an app called Log2Console to view the UDP logs.
Everything works fine when I run the app as an exe and I can see the UDP logs in Log2Console. However, when I install the exe as a service using TopShelf and start it I don't see any UDP logs.
I've tried turning off the Windows Firewall to see if that would make a difference but it did not. I've also tried changing the service logon details but no luck there either.
Any suggestions?
Thanks.
Had a similar issue and had to update the HostFactory set up to include log4net configuration within WhenStarted:
s.WhenStarted(lcp =>
{
// configure logging for hosted service
XmlConfigurator.ConfigureAndWatch(new FileInfo(".\\log4net.config"));
lcp.Start();
});