Hi,
I’m currently moving from NServiceBus.Log4Net
3.0 to NServiceBus.Extensions.Logging
1.0 with Microsoft.Extensions.Logging.Log4Net.AspNetCore
3.1 as suggested by the deprecation message.
The only code change I did/had to do is moving from
log4net.Config.XmlConfigurator.ConfigureAndWatch(
log4net.LogManager.GetRepository(Assembly.GetEntryAssembly()),
new FileInfo(Path.Combine(absoluteFolderPathOfExecutable, "log4net.config")));
LogManager.Use<Log4NetFactory>();
to this
var loggingOptions = new Log4NetProviderOptions(
Path.Combine(absoluteFolderPathOfExecutable, "log4net.config"),
true);
LogManager.UseFactory(
new ExtensionsLoggerFactory(
new LoggerFactory(new List<ILoggerProvider>() { new Log4NetProvider(loggingOptions) })));
BUT
using the simplest scenario to verify the logging still works (stop SQL Server that’s used as transport, run the endpoint and wait until the process kills itself).
I expect a lot of log messages, though I don’t understand why the amount I get with before and after are completely different:
Before:
I get 2x
2020-04-07 12:43:30,836 WARN NServiceBus.Transport.SQLServer.ExpiredMessagesPurger [(null)] Checking indexes on table [omitted] failed. Exception: System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
---> System.ComponentModel.Win32Exception (53): The network path was not found.`
and 1357x (which sounds like an incredibly large number of log messages)
2020-04-07 12:43:30,836 FATAL NServiceBus.Transport.SQLServer.DelayedMessageHandler [(null)] Exception thrown while performing cancellation
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
---> System.ComponentModel.Win32Exception (53): The network path was not found.
After:
still 2x MessagesPurger
but 3738x the DelayedMessageHandler
My questions:
- is it normal to have such a large number of log messages when NServiceBus cannot connect to the SQL Server Transport? What part of the configuration has an impact on how often it tries?
- Is there a reasonable explanation to have vastly different numbers between the two different versions/packages?
- Is there anything wrong with the configuration change I made?
Though the remaining 2 MessagesPurger log messages make me pretty confident I didn’t mess up with the change I did.
Let me know if you need additional information to answer my questions.
Thank you
Philipp