diff --git a/build-support/nuke-build/Build.cs b/build-support/nuke-build/Build.cs
index 29edaf19..412f9552 100644
--- a/build-support/nuke-build/Build.cs
+++ b/build-support/nuke-build/Build.cs
@@ -37,7 +37,7 @@ partial class Build : NukeBuild
readonly bool BuildEms = false;
[Parameter("Version")]
- readonly string ProjectVersion = "3.0.2";
+ readonly string ProjectVersion = "3.1.0";
[Solution] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FedExShippingService.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FedExShippingService.cs
index 656580a4..0ae96ead 100644
--- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FedExShippingService.cs
+++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FedExShippingService.cs
@@ -33,7 +33,7 @@ namespace Spring.Northwind.Service
public void ShipOrder(Order order)
{
- log.Info("Shipping order id = " + order.Id);
+ log.LogInformation("Shipping order id = {OrderId} ", order.Id);
}
}
}
diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FulfillmentService.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FulfillmentService.cs
index fd46b8e1..8b991956 100644
--- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FulfillmentService.cs
+++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FulfillmentService.cs
@@ -90,13 +90,13 @@ namespace Spring.Northwind.Service
{
if (order.ShippedDate.HasValue)
{
- log.Warn("Order with " + order.Id + " has already been shipped, skipping.");
+ log.LogWarning("Order {OrderId} has already been shipped, skipping.", order.Id);
continue;
}
//Validate Order
Validate(order);
- log.Info("Order " + order.Id + " validated, proceeding with shipping..");
+ log.LogInformation("Order {OrderId} validated, proceeding with shipping..", order.Id);
//Ship with external shipping service
ShippingService.ShipOrder(order);
diff --git a/examples/Spring/Spring.IoCQuickStart.MovieFinder/src/MovieFinder/Program.cs b/examples/Spring/Spring.IoCQuickStart.MovieFinder/src/MovieFinder/Program.cs
index b5b9239c..976dc633 100644
--- a/examples/Spring/Spring.IoCQuickStart.MovieFinder/src/MovieFinder/Program.cs
+++ b/examples/Spring/Spring.IoCQuickStart.MovieFinder/src/MovieFinder/Program.cs
@@ -67,18 +67,16 @@ namespace Spring.IocQuickStart.MovieFinder
MovieLister lister = (MovieLister) ctx.GetObject("MyMovieLister");
Movie[] movies = lister.MoviesDirectedBy("Roberto Benigni");
- LOG.Debug("Searching for movie...");
+ LOG.LogDebug("Searching for movie...");
foreach (Movie movie in movies)
{
- LOG.Debug(
- string.Format("Movie Title = '{0}', Director = '{1}'.",
- movie.Title, movie.Director));
+ LOG.LogDebug("Movie Title = '{Title}', Director = '{Director}'.", movie.Title, movie.Director);
}
- LOG.Debug("MovieApp Done.");
+ LOG.LogDebug("MovieApp Done.");
}
catch (Exception e)
{
- LOG.Error("Movie Finder is broken.", e);
+ LOG.LogError("Movie Finder is broken.", e);
}
finally
{
diff --git a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/Handlers/StockAppHandler.cs b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/Handlers/StockAppHandler.cs
index a2fd77cc..8c6af374 100644
--- a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/Handlers/StockAppHandler.cs
+++ b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/Handlers/StockAppHandler.cs
@@ -23,7 +23,7 @@ namespace Spring.MsmqQuickStart.Client.Handlers
public void Handle(string data)
{
- log.Info(string.Format("Received market data. " + data));
+ log.LogInformation("Received market data. " + data);
// forward to controller to update view
stockController.UpdateMarketData(data);
@@ -33,13 +33,13 @@ namespace Spring.MsmqQuickStart.Client.Handlers
public void Handle(TradeResponse tradeResponse)
{
- log.Info(string.Format("Received trade resonse. Ticker = {0}, Price = {1}", tradeResponse.Ticker, tradeResponse.Price));
+ log.LogInformation("Received trade resonse. Ticker = {TradeResponseTicker}, Price = {TradeResponsePrice}", tradeResponse.Ticker, tradeResponse.Price);
stockController.UpdateTrade(tradeResponse);
}
public void Handle(object catchAllObject)
{
- log.Error("could not handle object of type = " + catchAllObject.GetType());
+ log.LogError("could not handle object of type {ObjectType}", catchAllObject.GetType());
}
}
}
diff --git a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/Program.cs b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/Program.cs
index a0da755b..b7b3eafc 100644
--- a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/Program.cs
+++ b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/Program.cs
@@ -22,7 +22,7 @@ namespace Spring.MsmqQuickStart.Client
{
try
{
- log.Info("Running....");
+ log.LogInformation("Running....");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
using (IApplicationContext ctx = ContextRegistry.GetContext())
@@ -34,13 +34,13 @@ namespace Spring.MsmqQuickStart.Client
}
catch (Exception e)
{
- log.Error("Spring.MsmqQuickStart.Client is broken.", e);
+ log.LogError(e, "Spring.MsmqQuickStart.Client is broken.");
}
}
private static void ThreadException(object sender, ThreadExceptionEventArgs e)
{
- log.Error("Uncaught application exception.", e.Exception);
+ log.LogError(e.Exception, "Uncaught application exception.");
Application.Exit();
}
}
diff --git a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/UI/StockForm.cs b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/UI/StockForm.cs
index 1bd63c98..cce9d5da 100644
--- a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/UI/StockForm.cs
+++ b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Client/UI/StockForm.cs
@@ -34,7 +34,7 @@ namespace Spring.MsmqQuickStart.Client.UI
//Instead a hardcoded trade request is created in the controller.
tradeRequestStatusTextBox.Text = "Request Pending...";
stockController.SendTradeRequest();
- log.Info("Sent trade request.");
+ log.LogInformation("Sent trade request.");
}
public void UpdateTrade(TradeResponse trade)
diff --git a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Server/Gateways/MarketDataServiceGateway.cs b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Server/Gateways/MarketDataServiceGateway.cs
index 38be70d5..618778f2 100644
--- a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Server/Gateways/MarketDataServiceGateway.cs
+++ b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Server/Gateways/MarketDataServiceGateway.cs
@@ -29,9 +29,9 @@ namespace Spring.MsmqQuickStart.Server.Gateways
while (true)
{
string data = GenerateFakeMarketData();
- log.Info("Sending market data.");
+ log.LogInformation("Sending market data.");
MessageQueueTemplate.ConvertAndSend(data);
- log.Info("Sleeping " + sleepTimeInSeconds + " seconds before sending more market data.");
+ log.LogInformation("Sleeping {SleepTimeSeconds} seconds before sending more market data.", sleepTimeInSeconds);
Thread.Sleep(sleepTimeInSeconds);
}
}
@@ -59,4 +59,4 @@ namespace Spring.MsmqQuickStart.Server.Gateways
//y2 = x2 * w;
}
}
-}
\ No newline at end of file
+}
diff --git a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Server/Handlers/StockAppHandler.cs b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Server/Handlers/StockAppHandler.cs
index 5cbfaebc..0cad8608 100644
--- a/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Server/Handlers/StockAppHandler.cs
+++ b/examples/Spring/Spring.MsmqQuickStart/src/Spring/Spring.MsmqQuickStart.Server/Handlers/StockAppHandler.cs
@@ -26,7 +26,7 @@ namespace Spring.MsmqQuickStart.Server.Handlers
public TradeResponse Handle(TradeRequest tradeRequest)
{
- log.Info("received trade request - sleeping 2s to simulate long-running task");
+ log.LogInformation("received trade request - sleeping 2s to simulate long-running task");
TradeResponse tradeResponse;
ArrayList errors = new ArrayList();
if (creditCheckService.CanExecute(tradeRequest, errors))
diff --git a/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Client/Handlers/StockAppHandler.cs b/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Client/Handlers/StockAppHandler.cs
index e5a01ef8..d9289f53 100644
--- a/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Client/Handlers/StockAppHandler.cs
+++ b/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Client/Handlers/StockAppHandler.cs
@@ -44,7 +44,7 @@ namespace Spring.NmsQuickStart.Client.Handlers
public void Handle(Hashtable data)
{
- log.Info(string.Format("Received market data. Ticker = {0}, Price = {1}", data["TICKER"], data["PRICE"]));
+ log.LogInformation("Received market data. Ticker = {Ticker}, Price = {Price}", data["TICKER"], data["PRICE"]);
// forward to controller to update view
stockController.UpdateMarketData(data);
@@ -54,13 +54,13 @@ namespace Spring.NmsQuickStart.Client.Handlers
public void Handle(TradeResponse tradeResponse)
{
- log.Info(string.Format("Received trade resonse. Ticker = {0}, Price = {1}", tradeResponse.Ticker, tradeResponse.Price));
+ log.LogInformation("Received trade response. Ticker = {TradeResponseTicker}, Price = {TradeResponsePrice}", tradeResponse.Ticker, tradeResponse.Price);
stockController.UpdateTrade(tradeResponse);
}
public void Handle(object catchAllObject)
{
- log.Error("could not handle object of type = " + catchAllObject.GetType());
+ log.LogError("could not handle object of type = {ObjectType}", catchAllObject.GetType());
}
}
}
diff --git a/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Client/UI/StockForm.cs b/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Client/UI/StockForm.cs
index c408c87d..a3258df4 100644
--- a/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Client/UI/StockForm.cs
+++ b/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Client/UI/StockForm.cs
@@ -55,7 +55,7 @@ namespace Spring.NmsQuickStart.Client.UI
//Instead a hardcoded trade request is created in the controller.
tradeRequestStatusTextBox.Text = "Request Pending...";
stockController.SendTradeRequest();
- log.Info("Sent trade request.");
+ log.LogInformation("Sent trade request.");
}
public void UpdateTrade(TradeResponse trade)
diff --git a/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Server/Gateways/MarketDataServiceGateway.cs b/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Server/Gateways/MarketDataServiceGateway.cs
index 3cf5299f..8e511964 100644
--- a/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Server/Gateways/MarketDataServiceGateway.cs
+++ b/examples/Spring/Spring.NmsQuickStart/src/Spring/Spring.NmsQuickStart.Server/Gateways/MarketDataServiceGateway.cs
@@ -29,9 +29,9 @@ namespace Spring.NmsQuickStart.Server.Gateways
while (true)
{
IDictionary data = GenerateFakeMarketData();
- log.Info("Sending market data.");
+ log.LogInformation("Sending market data.");
NmsTemplate.ConvertAndSend(data);
- log.Info("Sleeping " + sleepTimeInSeconds + " seconds before sending more market data.");
+ log.LogInformation("Sleeping {SleepTimeInSeconds} seconds before sending more market data.", sleepTimeInSeconds);
Thread.Sleep(sleepTimeInSeconds);
}
}
diff --git a/examples/Spring/Spring.NmsQuickStart/test/Spring/Spring.NmsQuickStart.Tests/Spring.NmsQuickStart.Tests.csproj b/examples/Spring/Spring.NmsQuickStart/test/Spring/Spring.NmsQuickStart.Tests/Spring.NmsQuickStart.Tests.csproj
index aaba5354..f6bf6db5 100644
--- a/examples/Spring/Spring.NmsQuickStart/test/Spring/Spring.NmsQuickStart.Tests/Spring.NmsQuickStart.Tests.csproj
+++ b/examples/Spring/Spring.NmsQuickStart/test/Spring/Spring.NmsQuickStart.Tests/Spring.NmsQuickStart.Tests.csproj
@@ -14,7 +14,6 @@
TRACE;DEBUG;NET_4_0
prompt
4
- AllRules.ruleset
pdbonly
@@ -23,7 +22,6 @@
TRACE;NET_4_0
prompt
4
- AllRules.ruleset
Debug
diff --git a/src/Spring/Spring.Aop/Aop/Framework/Adapter/ThrowsAdviceInterceptor.cs b/src/Spring/Spring.Aop/Aop/Framework/Adapter/ThrowsAdviceInterceptor.cs
index 4d2b1be6..c01a3168 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/Adapter/ThrowsAdviceInterceptor.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/Adapter/ThrowsAdviceInterceptor.cs
@@ -165,7 +165,7 @@ namespace Spring.Aop.Framework.Adapter
if(log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Found exception handler method: " + method);
+ log.LogDebug("Found exception handler method: " + method);
}
#endregion
@@ -266,7 +266,7 @@ namespace Spring.Aop.Framework.Adapter
if(log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Trying to find handler for exception of type [" + exception.GetType().Name + "].");
+ log.LogDebug("Trying to find handler for exception of type [" + exception.GetType().Name + "].");
}
#endregion
diff --git a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAdvisorAutoProxyCreator.cs b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAdvisorAutoProxyCreator.cs
index 42c39213..42be5e46 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAdvisorAutoProxyCreator.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAdvisorAutoProxyCreator.cs
@@ -185,7 +185,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info($"Candidate advisor [{candidate}] accepted for targetType [{targetType}]");
+ logger.LogInformation($"Candidate advisor [{candidate}] accepted for targetType [{targetType}]");
}
eligibleAdvisors.Add(candidate);
}
@@ -200,7 +200,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info($"Candidate advisor [{candidate}] accepted for targetType [{targetType}]");
+ logger.LogInformation($"Candidate advisor [{candidate}] accepted for targetType [{targetType}]");
}
eligibleAdvisors.Add(candidate);
}
@@ -208,7 +208,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info($"Candidate advisor [{candidate}] rejected for targetType [{targetType}]");
+ logger.LogInformation($"Candidate advisor [{candidate}] rejected for targetType [{targetType}]");
}
}
}
diff --git a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs
index c249ce09..0b2e2635 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/AbstractAutoProxyCreator.cs
@@ -238,7 +238,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Did not attempt to autoproxy infrastructure type [{0}]", objectType));
+ logger.LogDebug(string.Format("Did not attempt to autoproxy infrastructure type [{0}]", objectType));
}
nonAdvisedObjects.Add(cacheKey);
@@ -249,7 +249,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Skipping type [{0}]", objectType));
+ logger.LogDebug(string.Format("Skipping type [{0}]", objectType));
}
nonAdvisedObjects.Add(cacheKey);
@@ -390,7 +390,7 @@ namespace Spring.Aop.Framework.AutoProxy
// found a match
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info(string.Format("TargetSourceCreator [{0} found custom TargetSource for object with objectName '{1}'", tsc, name));
+ logger.LogInformation(string.Format("TargetSourceCreator [{0} found custom TargetSource for object with objectName '{1}'", tsc, name));
}
return ts;
}
@@ -514,7 +514,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
int nrOfCommonInterceptors = commonInterceptors != null ? commonInterceptors.Count : 0;
int nrOfSpecificInterceptors = specificInterceptors != null ? specificInterceptors.Count : 0;
- logger.Info(string.Format("Creating implicit proxy for object '{0}' with {1} common interceptors and {2} specific interceptors", targetName, nrOfCommonInterceptors, nrOfSpecificInterceptors));
+ logger.LogInformation(string.Format("Creating implicit proxy for object '{0}' with {1} common interceptors and {2} specific interceptors", targetName, nrOfCommonInterceptors, nrOfSpecificInterceptors));
}
@@ -576,7 +576,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Did not attempt to autoproxy infrastructure type [{0}]", objectType));
+ logger.LogDebug(string.Format("Did not attempt to autoproxy infrastructure type [{0}]", objectType));
}
nonAdvisedObjects.Add(cacheKey);
@@ -587,7 +587,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Skipping type [{0}]", objectType));
+ logger.LogDebug(string.Format("Skipping type [{0}]", objectType));
}
nonAdvisedObjects.Add(cacheKey);
diff --git a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/ObjectFactoryAdvisorRetrievalHelper.cs b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/ObjectFactoryAdvisorRetrievalHelper.cs
index 0c8792c6..0ff70ec9 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/ObjectFactoryAdvisorRetrievalHelper.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/ObjectFactoryAdvisorRetrievalHelper.cs
@@ -90,7 +90,7 @@ namespace Spring.Aop.Framework.AutoProxy
{
if (_log.IsEnabled(LogLevel.Debug))
{
- _log.Debug(string.Format("Ignoring currently created advisor '{0}': exception message = {1}",
+ _log.LogDebug(string.Format("Ignoring currently created advisor '{0}': exception message = {1}",
name, ex.Message));
}
continue;
diff --git a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/Target/AbstractPrototypeTargetSourceCreator.cs b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/Target/AbstractPrototypeTargetSourceCreator.cs
index 06e0fdb7..7ba6b00c 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/Target/AbstractPrototypeTargetSourceCreator.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/AutoProxy/Target/AbstractPrototypeTargetSourceCreator.cs
@@ -63,14 +63,14 @@ namespace Spring.Aop.Framework.AutoProxy.Target
if (!(factory is IObjectDefinitionRegistry))
{
if (logger.IsEnabled(LogLevel.Warning))
- logger.Warn("Cannot do autopooling with a IObjectFactory that doesn't implement IObjectDefinitionRegistry");
+ logger.LogWarning("Cannot do autopooling with a IObjectFactory that doesn't implement IObjectDefinitionRegistry");
return null;
}
IObjectDefinitionRegistry definitionRegistry = (IObjectDefinitionRegistry) factory;
RootObjectDefinition definition = (RootObjectDefinition) definitionRegistry.GetObjectDefinition(name);
if (logger.IsEnabled(LogLevel.Information))
- logger.Info("Configuring AbstractPrototypeBasedTargetSource...");
+ logger.LogInformation("Configuring AbstractPrototypeBasedTargetSource...");
// Infinite cycle will result if we don't use a different factory,
// because a GetObject() call with this objectName will go through the autoproxy
diff --git a/src/Spring/Spring.Aop/Aop/Framework/ProxyFactoryObject.cs b/src/Spring/Spring.Aop/Aop/Framework/ProxyFactoryObject.cs
index e18a803a..0df87344 100644
--- a/src/Spring/Spring.Aop/Aop/Framework/ProxyFactoryObject.cs
+++ b/src/Spring/Spring.Aop/Aop/Framework/ProxyFactoryObject.cs
@@ -367,8 +367,8 @@ namespace Spring.Aop.Framework
if (targetName == null)
{
- logger.Warn("Using non-singleton proxies with singleton targets is often undesirable. " +
- "Enable prototype proxies by setting the 'targetName' property.");
+ logger.LogWarning("Using non-singleton proxies with singleton targets is often undesirable. " +
+ "Enable prototype proxies by setting the 'targetName' property.");
}
return NewPrototypeInstance();
}
@@ -442,7 +442,7 @@ namespace Spring.Aop.Framework
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Creating copy of prototype ProxyFactoryObject config: " + this);
+ logger.LogDebug("Creating copy of prototype ProxyFactoryObject config: " + this);
}
// The copy needs a fresh advisor chain, and a fresh TargetSource.
@@ -454,7 +454,7 @@ namespace Spring.Aop.Framework
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Using ProxyConfig: " + copy);
+ logger.LogDebug("Using ProxyConfig: " + copy);
}
object generatedProxy = copy.CreateAopProxy().GetProxy();
@@ -469,7 +469,7 @@ namespace Spring.Aop.Framework
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Initialize: begin configure target, interceptors and introductions for {0}[{1}]", GetType().Name, GetHashCode()));
+ logger.LogDebug(string.Format("Initialize: begin configure target, interceptors and introductions for {0}[{1}]", GetType().Name, GetHashCode()));
}
InitializeAdvisorChain();
@@ -477,7 +477,7 @@ namespace Spring.Aop.Framework
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Initialize: completed configuration for {0}[{1}]: {2}", GetType().Name, GetHashCode(), ToProxyConfigString()));
+ logger.LogDebug(string.Format("Initialize: completed configuration for {0}[{1}]: {2}", GetType().Name, GetHashCode(), ToProxyConfigString()));
}
}
@@ -523,7 +523,7 @@ namespace Spring.Aop.Framework
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Adding global advisor '" + name + "'");
+ logger.LogDebug("Adding global advisor '" + name + "'");
}
AddGlobalAdvisor(lof, name.Substring(0, (name.Length - GlobalInterceptorSuffix.Length)));
@@ -532,7 +532,7 @@ namespace Spring.Aop.Framework
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("resolving advisor name " + "'" + name + "'");
+ logger.LogDebug("resolving advisor name " + "'" + name + "'");
}
// If we get here, we need to add a named interceptor.
@@ -558,7 +558,7 @@ namespace Spring.Aop.Framework
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Adding advisor list '{0}'", name));
+ logger.LogDebug(string.Format("Adding advisor list '{0}'", name));
}
IAdvisors advisors = (IAdvisors)advice;
@@ -566,7 +566,7 @@ namespace Spring.Aop.Framework
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Adding advisor '{0}' of type {1}", name, element.GetType().FullName));
+ logger.LogDebug(string.Format("Adding advisor '{0}' of type {1}", name, element.GetType().FullName));
}
IAdvisor advisor = NamedObjectToAdvisor(element);
@@ -577,7 +577,7 @@ namespace Spring.Aop.Framework
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Adding advisor '{0}' of type {1}", name, advice.GetType().FullName));
+ logger.LogDebug(string.Format("Adding advisor '{0}' of type {1}", name, advice.GetType().FullName));
}
IAdvisor advisor = NamedObjectToAdvisor(advice);
@@ -679,7 +679,7 @@ namespace Spring.Aop.Framework
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Adding introduction '" + name + "'");
+ logger.LogDebug("Adding introduction '" + name + "'");
}
if (name.EndsWith(GlobalInterceptorSuffix))
@@ -783,7 +783,7 @@ namespace Spring.Aop.Framework
/// object name from which we obtained this object in our owning object factory
private void AddIntroductionOnChainCreation(object introduction, string name)
{
- logger.Debug($"Adding introduction with name '{name}'");
+ logger.LogDebug($"Adding introduction with name '{name}'");
IIntroductionAdvisor advisor = NamedObjectToIntroduction(introduction);
AddIntroduction(advisor);
}
@@ -797,7 +797,7 @@ namespace Spring.Aop.Framework
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Not Refreshing TargetSource: No target name specified");
+ logger.LogDebug("Not Refreshing TargetSource: No target name specified");
}
return TargetSource;
@@ -807,7 +807,7 @@ namespace Spring.Aop.Framework
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Refreshing TargetSource with name '" + targetName + "'");
+ logger.LogDebug("Refreshing TargetSource with name '" + targetName + "'");
}
object target = objectFactory.GetObject(targetName);
@@ -830,7 +830,7 @@ namespace Spring.Aop.Framework
PrototypePlaceholder pa = (PrototypePlaceholder)advisor;
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Refreshing advisor '{0}'", pa.ObjectName));
+ logger.LogDebug(string.Format("Refreshing advisor '{0}'", pa.ObjectName));
}
AssertUtils.ArgumentNotNull(objectFactory, "ObjectFactory");
@@ -862,7 +862,7 @@ namespace Spring.Aop.Framework
PrototypePlaceholder pa = (PrototypePlaceholder)introduction;
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Refreshing introduction '{0}'", pa.ObjectName));
+ logger.LogDebug(string.Format("Refreshing introduction '{0}'", pa.ObjectName));
}
AssertUtils.ArgumentNotNull(objectFactory, "ObjectFactory");
@@ -934,7 +934,7 @@ namespace Spring.Aop.Framework
///
protected override void InterfacesChanged()
{
- logger.Info("Implemented interfaces have changed; reseting singleton instance");
+ logger.LogInformation("Implemented interfaces have changed; reseting singleton instance");
singletonInstance = null;
base.InterfacesChanged();
}
@@ -967,7 +967,7 @@ namespace Spring.Aop.Framework
targetName = finalName;
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format("Object with name '{0}' concluding interceptor chain is not an advisor class: treating it as a target or TargetSource", finalName));
+ logger.LogDebug(string.Format("Object with name '{0}' concluding interceptor chain is not an advisor class: treating it as a target or TargetSource", finalName));
}
String[] newNames = new String[interceptorNames.Length - 1];
Array.Copy(interceptorNames, 0, newNames, 0, newNames.Length);
diff --git a/src/Spring/Spring.Aop/Aop/Support/SdkRegularExpressionMethodPointcut.cs b/src/Spring/Spring.Aop/Aop/Support/SdkRegularExpressionMethodPointcut.cs
index 330d424f..ad83c7ff 100644
--- a/src/Spring/Spring.Aop/Aop/Support/SdkRegularExpressionMethodPointcut.cs
+++ b/src/Spring/Spring.Aop/Aop/Support/SdkRegularExpressionMethodPointcut.cs
@@ -160,8 +160,8 @@ namespace Spring.Aop.Support
if (_logger.IsEnabled(LogLevel.Debug))
{
- _logger.Debug("Candidate is: '" + pattern + "'; pattern is '" +
- _compiledPatterns[patternIndex].ToString() + "'; matched=" + matched);
+ _logger.LogDebug("Candidate is: '" + pattern + "'; pattern is '" +
+ _compiledPatterns[patternIndex].ToString() + "'; matched=" + matched);
}
return matched;
diff --git a/src/Spring/Spring.Aop/Aop/Target/AbstractPrototypeTargetSource.cs b/src/Spring/Spring.Aop/Aop/Target/AbstractPrototypeTargetSource.cs
index f1990d53..6b2c1474 100644
--- a/src/Spring/Spring.Aop/Aop/Target/AbstractPrototypeTargetSource.cs
+++ b/src/Spring/Spring.Aop/Aop/Target/AbstractPrototypeTargetSource.cs
@@ -138,9 +138,9 @@ namespace Spring.Aop.Target
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format(
- "Getting object with name '{0}' to determine class.",
- TargetObjectName));
+ logger.LogDebug(string.Format(
+ "Getting object with name '{0}' to determine class.",
+ TargetObjectName));
}
#endregion
@@ -162,9 +162,9 @@ namespace Spring.Aop.Target
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format(
- "Creating new target from object '{0}'.",
- TargetObjectName));
+ logger.LogDebug(string.Format(
+ "Creating new target from object '{0}'.",
+ TargetObjectName));
}
#endregion
diff --git a/src/Spring/Spring.Aop/Aop/Target/SimplePoolTargetSource.cs b/src/Spring/Spring.Aop/Aop/Target/SimplePoolTargetSource.cs
index eda8f03d..22b4202c 100644
--- a/src/Spring/Spring.Aop/Aop/Target/SimplePoolTargetSource.cs
+++ b/src/Spring/Spring.Aop/Aop/Target/SimplePoolTargetSource.cs
@@ -69,7 +69,7 @@ namespace Spring.Aop.Target
if(logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Creating object pool.");
+ logger.LogDebug("Creating object pool.");
}
#endregion
@@ -138,7 +138,7 @@ namespace Spring.Aop.Target
if(logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Closing pool...");
+ logger.LogDebug("Closing pool...");
}
#endregion
diff --git a/src/Spring/Spring.Aop/Aop/Target/ThreadLocalTargetSource.cs b/src/Spring/Spring.Aop/Aop/Target/ThreadLocalTargetSource.cs
index 0c061b35..f5ca120d 100644
--- a/src/Spring/Spring.Aop/Aop/Target/ThreadLocalTargetSource.cs
+++ b/src/Spring/Spring.Aop/Aop/Target/ThreadLocalTargetSource.cs
@@ -148,10 +148,10 @@ namespace Spring.Aop.Target
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format(
- "No target for apartment prototype '{0}' " +
- "found in thread: creating one and binding it to thread '#{1}'",
- TargetObjectName, Thread.CurrentThread.GetHashCode()));
+ logger.LogDebug(string.Format(
+ "No target for apartment prototype '{0}' " +
+ "found in thread: creating one and binding it to thread '#{1}'",
+ TargetObjectName, Thread.CurrentThread.GetHashCode()));
}
#endregion
@@ -187,7 +187,7 @@ namespace Spring.Aop.Target
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Destroying ThreadLocal bindings");
+ logger.LogDebug("Destroying ThreadLocal bindings");
}
#endregion
@@ -205,12 +205,13 @@ namespace Spring.Aop.Target
#region Instrumentation
if (logger.IsEnabled(LogLevel.Warning))
- {
- logger.Warn(string.Format(
- "Thread-bound target of class '{0}' " +
- "threw exception from it's IDisposable.Dispose() method.",
- target.GetType()), ex);
- }
+ {
+ string message = string.Format(
+ "Thread-bound target of class '{0}' " +
+ "threw exception from it's IDisposable.Dispose() method.",
+ target.GetType());
+ logger.LogWarning(ex, message);
+ }
#endregion
}
diff --git a/src/Spring/Spring.Aop/Aspects/AbstractExceptionHandler.cs b/src/Spring/Spring.Aop/Aspects/AbstractExceptionHandler.cs
index ea220152..007ad5ec 100644
--- a/src/Spring/Spring.Aop/Aspects/AbstractExceptionHandler.cs
+++ b/src/Spring/Spring.Aop/Aspects/AbstractExceptionHandler.cs
@@ -19,6 +19,7 @@
#endregion
using System.Collections;
+using Microsoft.Extensions.Logging;
using Spring.Expressions;
namespace Spring.Aspects
@@ -155,11 +156,13 @@ namespace Spring.Aspects
canProcess = (bool) expression.GetValue(null, callContextDictionary);
} catch (InvalidCastException e)
{
- log.Warn("Was not able to unbox constraint expression to boolean [" + ConstraintExpressionText + "]", e);
+ string message = "Was not able to unbox constraint expression to boolean [" + ConstraintExpressionText + "]";
+ log.LogWarning(e, message);
return false;
} catch (Exception e)
{
- log.Warn("Was not able to evaluate constraint expression [" + ConstraintExpressionText + "]",e);
+ string message = "Was not able to evaluate constraint expression [" + ConstraintExpressionText + "]";
+ log.LogWarning(e, message);
return false;
}
return canProcess;
diff --git a/src/Spring/Spring.Aop/Aspects/Cache/CacheParameterAdvice.cs b/src/Spring/Spring.Aop/Aspects/Cache/CacheParameterAdvice.cs
index 9c5c1d88..b6e016e9 100644
--- a/src/Spring/Spring.Aop/Aspects/Cache/CacheParameterAdvice.cs
+++ b/src/Spring/Spring.Aop/Aspects/Cache/CacheParameterAdvice.cs
@@ -139,7 +139,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isLogDebugEnabled)
{
- logger.Debug(string.Format("Caching parameter for key [{0}] into cache [{1}].", key, paramInfo.CacheName));
+ logger.LogDebug(string.Format("Caching parameter for key [{0}] into cache [{1}].", key, paramInfo.CacheName));
}
#endregion
diff --git a/src/Spring/Spring.Aop/Aspects/Cache/CacheResultAdvice.cs b/src/Spring/Spring.Aop/Aspects/Cache/CacheResultAdvice.cs
index 0990bd54..9e54d253 100644
--- a/src/Spring/Spring.Aop/Aspects/Cache/CacheResultAdvice.cs
+++ b/src/Spring/Spring.Aop/Aspects/Cache/CacheResultAdvice.cs
@@ -199,7 +199,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isLogDebugEnabled)
{
- logger.Debug(String.Format("Object for key [{0}] was of type [{1}] which is not compatible with return type [{2}]. Proceeding...", resultKey, returnValue.GetType(), returnType));
+ logger.LogDebug(String.Format("Object for key [{0}] was of type [{1}] which is not compatible with return type [{2}]. Proceeding...", resultKey, returnValue.GetType(), returnType));
}
#endregion
@@ -212,7 +212,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isLogDebugEnabled)
{
- logger.Debug(String.Format("Object for key [{0}] was not found in cache [{1}]. Proceeding...", resultKey, resultInfo.CacheName));
+ logger.LogDebug(String.Format("Object for key [{0}] was not found in cache [{1}]. Proceeding...", resultKey, resultInfo.CacheName));
}
#endregion
@@ -222,7 +222,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isLogDebugEnabled)
{
- logger.Debug(String.Format("Caching object for key [{0}] into cache [{1}].", resultKey, resultInfo.CacheName));
+ logger.LogDebug(String.Format("Caching object for key [{0}] into cache [{1}].", resultKey, resultInfo.CacheName));
}
#endregion
cache.Insert(resultKey, (returnValue == null) ? NullValue : returnValue, resultInfo.TimeToLiveTimeSpan);
@@ -233,7 +233,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isLogDebugEnabled)
{
- logger.Debug(String.Format("Object for key [{0}] found in cache [{1}]. Aborting invocation...", resultKey, resultInfo.CacheName));
+ logger.LogDebug(String.Format("Object for key [{0}] found in cache [{1}]. Aborting invocation...", resultKey, resultInfo.CacheName));
}
#endregion
}
@@ -277,7 +277,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isDebugEnabled)
{
- logger.Debug("Caching collection item for key [" + itemKey + "].");
+ logger.LogDebug("Caching collection item for key [" + itemKey + "].");
}
#endregion
cache.Insert(itemKey, (item == null ? NullValue : item), itemInfo.TimeToLiveTimeSpan);
diff --git a/src/Spring/Spring.Aop/Aspects/Cache/InvalidateCacheAdvice.cs b/src/Spring/Spring.Aop/Aspects/Cache/InvalidateCacheAdvice.cs
index cb43374b..a9d53bb9 100644
--- a/src/Spring/Spring.Aop/Aspects/Cache/InvalidateCacheAdvice.cs
+++ b/src/Spring/Spring.Aop/Aspects/Cache/InvalidateCacheAdvice.cs
@@ -117,7 +117,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isLogDebugEnabled)
{
- logger.Debug(string.Format("Removing objects for keys [{0}] from cache [{1}].", keys, cacheInfo.CacheName));
+ logger.LogDebug(string.Format("Removing objects for keys [{0}] from cache [{1}].", keys, cacheInfo.CacheName));
}
#endregion
cache.RemoveAll((ICollection) keys);
@@ -127,7 +127,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isLogDebugEnabled)
{
- logger.Debug(string.Format("Removing object for key [{0}] from cache [{1}].", keys, cacheInfo.CacheName));
+ logger.LogDebug(string.Format("Removing object for key [{0}] from cache [{1}].", keys, cacheInfo.CacheName));
}
#endregion
cache.Remove(keys);
@@ -138,7 +138,7 @@ namespace Spring.Aspects.Cache
#region Instrumentation
if (isLogDebugEnabled)
{
- logger.Debug(string.Format("Invalidate cache [{0}].", cacheInfo.CacheName));
+ logger.LogDebug(string.Format("Invalidate cache [{0}].", cacheInfo.CacheName));
}
#endregion
cache.Clear();
diff --git a/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs b/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs
index f4794fab..499340f6 100644
--- a/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs
+++ b/src/Spring/Spring.Aop/Aspects/Exceptions/ExceptionHandlerAdvice.cs
@@ -22,8 +22,7 @@ using System.Collections;
using System.Reflection;
using AopAlliance.Intercept;
-
-
+using Microsoft.Extensions.Logging;
using Spring.Util;
namespace Spring.Aspects.Exceptions
@@ -321,7 +320,7 @@ namespace Spring.Aspects.Exceptions
if (!parsedAdviceExpression.Success)
{
- log.Warn("Could not parse exception hander statement " + handlerString);
+ log.LogWarning("Could not parse exception hander statement " + handlerString);
return null;
}
@@ -450,7 +449,7 @@ namespace Spring.Aspects.Exceptions
}
else
{
- log.Warn("Could not parse exception hander statement " + parsedAdviceExpression.AdviceExpression);
+ log.LogWarning("Could not parse exception hander statement " + parsedAdviceExpression.AdviceExpression);
}
return null;
}
diff --git a/src/Spring/Spring.Aop/Aspects/Exceptions/ExecuteSpelExceptionHandler.cs b/src/Spring/Spring.Aop/Aspects/Exceptions/ExecuteSpelExceptionHandler.cs
index 2b14ea49..ed8d2943 100644
--- a/src/Spring/Spring.Aop/Aspects/Exceptions/ExecuteSpelExceptionHandler.cs
+++ b/src/Spring/Spring.Aop/Aspects/Exceptions/ExecuteSpelExceptionHandler.cs
@@ -1,3 +1,4 @@
+using Microsoft.Extensions.Logging;
using Spring.Expressions;
namespace Spring.Aspects.Exceptions
@@ -36,7 +37,8 @@ namespace Spring.Aspects.Exceptions
}
catch (Exception e)
{
- log.Warn("Was not able to evaluate action expression [" + ActionExpressionText + "]", e);
+ string message = "Was not able to evaluate action expression [" + ActionExpressionText + "]";
+ log.LogWarning(e, message);
}
return null;
}
diff --git a/src/Spring/Spring.Aop/Aspects/Exceptions/LogExceptionHandler.cs b/src/Spring/Spring.Aop/Aspects/Exceptions/LogExceptionHandler.cs
index 4889058a..0921c32a 100644
--- a/src/Spring/Spring.Aop/Aspects/Exceptions/LogExceptionHandler.cs
+++ b/src/Spring/Spring.Aop/Aspects/Exceptions/LogExceptionHandler.cs
@@ -142,7 +142,8 @@ namespace Spring.Aspects.Exceptions
}
catch (Exception e)
{
- log.Warn("Was not able to evaluate action expression [" + ActionExpressionText + "]", e);
+ string message = "Was not able to evaluate action expression [" + ActionExpressionText + "]";
+ log.LogWarning(e, message);
}
return "logged";
}
diff --git a/src/Spring/Spring.Aop/Aspects/Exceptions/ReturnValueExceptionHandler.cs b/src/Spring/Spring.Aop/Aspects/Exceptions/ReturnValueExceptionHandler.cs
index 03d64b08..224d3290 100644
--- a/src/Spring/Spring.Aop/Aspects/Exceptions/ReturnValueExceptionHandler.cs
+++ b/src/Spring/Spring.Aop/Aspects/Exceptions/ReturnValueExceptionHandler.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Expressions;
namespace Spring.Aspects.Exceptions
@@ -60,7 +61,8 @@ namespace Spring.Aspects.Exceptions
}
catch (Exception e)
{
- log.Warn("Was not able to evaluate action expression [" + ActionExpressionText + "]", e);
+ string message = "Was not able to evaluate action expression [" + ActionExpressionText + "]";
+ log.LogWarning(e, message);
}
return returnVal;
}
diff --git a/src/Spring/Spring.Aop/Aspects/Exceptions/TranslationExceptionHandler.cs b/src/Spring/Spring.Aop/Aspects/Exceptions/TranslationExceptionHandler.cs
index df1d2dd8..604b004b 100644
--- a/src/Spring/Spring.Aop/Aspects/Exceptions/TranslationExceptionHandler.cs
+++ b/src/Spring/Spring.Aop/Aspects/Exceptions/TranslationExceptionHandler.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Expressions;
namespace Spring.Aspects.Exceptions
@@ -58,7 +59,8 @@ namespace Spring.Aspects.Exceptions
}
catch (Exception e)
{
- log.Warn("Was not able to evaluate action expression [" + ActionExpressionText + "]", e);
+ string message = "Was not able to evaluate action expression [" + ActionExpressionText + "]";
+ log.LogWarning(e, message);
}
Exception translatedException = o as Exception;
if (translatedException != null)
diff --git a/src/Spring/Spring.Aop/Aspects/Logging/SimpleLoggingAdvice.cs b/src/Spring/Spring.Aop/Aspects/Logging/SimpleLoggingAdvice.cs
index 1d80c28a..775ace36 100644
--- a/src/Spring/Spring.Aop/Aspects/Logging/SimpleLoggingAdvice.cs
+++ b/src/Spring/Spring.Aop/Aspects/Logging/SimpleLoggingAdvice.cs
@@ -420,19 +420,19 @@ namespace Spring.Aspects.Logging
case LogLevel.Trace:
if (log.IsEnabled(LogLevel.Trace))
{
- if (e == null) log.Trace(text); else log.LogTrace(e, text);
+ if (e == null) log.LogTrace(text); else log.LogTrace(e, text);
}
break;
case LogLevel.Debug:
if (log.IsEnabled(LogLevel.Debug))
{
- if (e == null) log.Debug(text); else log.Debug(text, e);
+ if (e == null) log.LogDebug(text); else log.LogDebug(e, text);
}
break;
case LogLevel.Error:
if (log.IsEnabled(LogLevel.Error))
{
- if (e == null) log.Error(text); else log.Error(text, e);
+ if (e == null) log.LogError(text); else log.LogError(e, text);
}
break;
case LogLevel.Critical:
@@ -444,13 +444,13 @@ namespace Spring.Aspects.Logging
case LogLevel.Information:
if (log.IsEnabled(LogLevel.Information))
{
- if (e == null) log.Info(text); else log.LogInformation(e, text);
+ if (e == null) log.LogInformation(text); else log.LogInformation(e, text);
}
break;
case LogLevel.Warning:
if (log.IsEnabled(LogLevel.Warning))
{
- if (e == null) log.Warn(text); else log.LogWarning(e, text);
+ if (e == null) log.LogWarning(text); else log.LogWarning(e, text);
}
break;
case LogLevel.None:
diff --git a/src/Spring/Spring.Aop/Aspects/RetryAdvice.cs b/src/Spring/Spring.Aop/Aspects/RetryAdvice.cs
index b536f15f..51f7c467 100644
--- a/src/Spring/Spring.Aop/Aspects/RetryAdvice.cs
+++ b/src/Spring/Spring.Aop/Aspects/RetryAdvice.cs
@@ -175,7 +175,7 @@ namespace Spring.Aspects
{
if (log.IsEnabled(LogLevel.Trace))
{
- log.Trace("Retrying " + invocation.Method.Name);
+ log.LogTrace("Retrying " + invocation.Method.Name);
}
callContextDictionary["n"] = numAttempts;
Sleep(retryExceptionHandler, callContextDictionary, sleepHandler);
@@ -189,7 +189,7 @@ namespace Spring.Aspects
} while (numAttempts <= retryExceptionHandler.MaximumRetryCount);
- log.Debug("Invoked successfully after " + numAttempts + " attempt(s)");
+ log.LogDebug("Invoked successfully after " + numAttempts + " attempt(s)");
return returnVal;
}
@@ -212,12 +212,14 @@ namespace Spring.Aspects
}
catch (InvalidCastException e)
{
- log.Warn("Was not able to cast expression to decimal [" + handler.DelayRateExpression + "]. Sleeping for 1 second", e);
+ string message = "Was not able to cast expression to decimal [" + handler.DelayRateExpression + "]. Sleeping for 1 second";
+ log.LogWarning(e, message);
sleepHandler(new TimeSpan(0,0,1));
}
catch (Exception e)
{
- log.Warn("Was not able to evaluate rate expression [" + handler.DelayRateExpression + "]. Sleeping for 1 second", e);
+ string message = "Was not able to evaluate rate expression [" + handler.DelayRateExpression + "]. Sleeping for 1 second";
+ log.LogWarning(e, message);
sleepHandler(new TimeSpan(0,0,1));
}
}
@@ -281,7 +283,7 @@ namespace Spring.Aspects
if (!parsedAdviceExpression.Success)
{
- log.Warn("Could not parse retry expression " + retryExpressionString);
+ log.LogWarning("Could not parse retry expression " + retryExpressionString);
return null;
}
@@ -302,7 +304,7 @@ namespace Spring.Aspects
handler.DelayTimeSpan = (TimeSpan) timeSpanConverter.ConvertFrom(null, null, ts);
} catch (Exception)
{
- log.Warn("Could not parse timespan " + match.Groups[3].Value.Trim());
+ log.LogWarning("Could not parse timespan " + match.Groups[3].Value.Trim());
return null;
}
return handler;
diff --git a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AbstractLoadTypeFilter.cs b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AbstractLoadTypeFilter.cs
index c2a7203d..14d535f2 100644
--- a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AbstractLoadTypeFilter.cs
+++ b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AbstractLoadTypeFilter.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Core.TypeResolution;
namespace Spring.Context.Attributes.TypeFilters
@@ -58,7 +59,7 @@ namespace Spring.Context.Attributes.TypeFilters
catch (Exception)
{
RequiredType = null;
- Logger.Error("Can't load type defined in expression:" + typeToLoad);
+ Logger.LogError("Can't load type defined in expression:" + typeToLoad);
}
}
diff --git a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/CustomTypeFactory.cs b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/CustomTypeFactory.cs
index b24bc58e..c80b5f0f 100644
--- a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/CustomTypeFactory.cs
+++ b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/CustomTypeFactory.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Core.TypeResolution;
using Spring.Util;
using Spring.Objects.Factory.Support;
@@ -65,7 +66,7 @@ namespace Spring.Context.Attributes.TypeFilters
}
catch
{
- Logger.Error(string.Format("Can't instatiate {0}. Type needs to have a non arg constructor.", expression));
+ Logger.LogError(string.Format("Can't instatiate {0}. Type needs to have a non arg constructor.", expression));
}
return null;
@@ -80,7 +81,7 @@ namespace Spring.Context.Attributes.TypeFilters
}
catch (Exception)
{
- Logger.Error("Can't load type defined in exoression:" + typeToLoad);
+ Logger.LogError("Can't load type defined in exoression:" + typeToLoad);
}
return null;
diff --git a/src/Spring/Spring.Core/Context/Config/ComponentScanObjectDefinitionParser.cs b/src/Spring/Spring.Core/Context/Config/ComponentScanObjectDefinitionParser.cs
index d626bb7f..9024c8a0 100644
--- a/src/Spring/Spring.Core/Context/Config/ComponentScanObjectDefinitionParser.cs
+++ b/src/Spring/Spring.Core/Context/Config/ComponentScanObjectDefinitionParser.cs
@@ -103,7 +103,7 @@ namespace Spring.Context.Config
foreach (var baseAssembly in baseAssemblies.Split(','))
{
if (Logger.IsEnabled(LogLevel.Debug))
- Logger.Debug("Start With Assembly Filter: " + baseAssembly);
+ Logger.LogDebug("Start With Assembly Filter: " + baseAssembly);
scanner.WithAssemblyFilter(assy => assy.FullName.StartsWith(baseAssembly));
}
diff --git a/src/Spring/Spring.Core/Context/Support/AbstractApplicationContext.cs b/src/Spring/Spring.Core/Context/Support/AbstractApplicationContext.cs
index 22c605d1..6689fd7c 100644
--- a/src/Spring/Spring.Core/Context/Support/AbstractApplicationContext.cs
+++ b/src/Spring/Spring.Core/Context/Support/AbstractApplicationContext.cs
@@ -241,10 +241,10 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
- CultureInfo.InvariantCulture,
- "Closing application context [{0}].",
- Name));
+ log.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "Closing application context [{0}].",
+ Name));
}
// Closed event is raised before destroying objectfactory to enable registered IApplicationEventListeners
@@ -587,7 +587,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"processed {factoryProcessorNames.Count} IFactoryObjectPostProcessors defined in application context [{Name}].");
+ log.LogDebug($"processed {factoryProcessorNames.Count} IFactoryObjectPostProcessors defined in application context [{Name}].");
}
}
@@ -648,8 +648,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- $"processed {objectProcessors.Count} IObjectPostProcessors defined in application context [{Name}].");
+ log.LogDebug($"processed {objectProcessors.Count} IObjectPostProcessors defined in application context [{Name}].");
}
}
@@ -679,8 +678,8 @@ namespace Spring.Context.Support
{
_eventRegistry = (IEventRegistry)candidateRegistry;
- log.Debug(StringUtils.Surround(
- "Using IEventRegistry [", EventRegistry, "]"));
+ log.LogDebug(StringUtils.Surround(
+ "Using IEventRegistry [", EventRegistry, "]"));
}
else
{
@@ -688,11 +687,11 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Warning))
{
- log.Warn(string.Format(
- "Found object in context named '{0}' : this name " +
- "is typically reserved for IEventRegistry objects. " +
- "Falling back to default '{1}'.",
- EventRegistryObjectName, EventRegistry));
+ log.LogWarning(string.Format(
+ "Found object in context named '{0}' : this name " +
+ "is typically reserved for IEventRegistry objects. " +
+ "Falling back to default '{1}'.",
+ EventRegistryObjectName, EventRegistry));
}
}
}
@@ -702,8 +701,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- $"No IEventRegistry found with name '{EventRegistryObjectName}' : using default '{EventRegistry}'.");
+ log.LogDebug($"No IEventRegistry found with name '{EventRegistryObjectName}' : using default '{EventRegistry}'.");
}
}
var interestedParties = GetObjects(true, false).Values;
@@ -765,8 +763,8 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(StringUtils.Surround(
- "Using MessageSource [", MessageSource, "]"));
+ log.LogDebug(StringUtils.Surround(
+ "Using MessageSource [", MessageSource, "]"));
}
}
else
@@ -776,11 +774,11 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Warning))
{
- log.Warn(string.Format(
- "Found object in context named '{0}' : this name " +
- "is typically reserved for IMessageSource objects. " +
- "Falling back to default '{1}'.",
- MessageSourceObjectName, MessageSource));
+ log.LogWarning(string.Format(
+ "Found object in context named '{0}' : this name " +
+ "is typically reserved for IMessageSource objects. " +
+ "Falling back to default '{1}'.",
+ MessageSourceObjectName, MessageSource));
}
}
}
@@ -792,9 +790,9 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
- "No message source found in the current context: using parent context's message source '{0}'.",
- MessageSource));
+ log.LogDebug(string.Format(
+ "No message source found in the current context: using parent context's message source '{0}'.",
+ MessageSource));
}
}
else
@@ -804,9 +802,9 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
- "No IMessageSource found with name '{0}' : using default '{1}'.",
- MessageSourceObjectName, MessageSource));
+ log.LogDebug(string.Format(
+ "No IMessageSource found with name '{0}' : using default '{1}'.",
+ MessageSourceObjectName, MessageSource));
}
}
}
@@ -859,7 +857,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("ApplicationContext Refresh: Refreshing object factory "));
+ log.LogDebug(string.Format("ApplicationContext Refresh: Refreshing object factory "));
}
RefreshObjectFactory();
@@ -868,35 +866,35 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("ApplicationContext Refresh: Registering well-known processors and objects"));
+ log.LogDebug(string.Format("ApplicationContext Refresh: Registering well-known processors and objects"));
}
PrepareObjectFactory(objectFactory);
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("ApplicationContext Refresh: Custom post processing object factory"));
+ log.LogDebug(string.Format("ApplicationContext Refresh: Custom post processing object factory"));
}
PostProcessObjectFactory(objectFactory);
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("ApplicationContext Refresh: Post processing object factory using pre-registered processors"));
+ log.LogDebug(string.Format("ApplicationContext Refresh: Post processing object factory using pre-registered processors"));
}
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
- CultureInfo.InvariantCulture,
- "{0} objects defined in application context [{1}].",
- ObjectDefinitionCount == 0 ? "No" : ObjectDefinitionCount.ToString(),
- Name));
+ log.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "{0} objects defined in application context [{1}].",
+ ObjectDefinitionCount == 0 ? "No" : ObjectDefinitionCount.ToString(),
+ Name));
}
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("ApplicationContext Refresh: Post processing object factory using defined processors"));
+ log.LogDebug(string.Format("ApplicationContext Refresh: Post processing object factory using defined processors"));
}
InvokeObjectFactoryPostProcessors(objectFactory);
@@ -911,7 +909,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("ApplicationContext Refresh: Preinstantiating singletons"));
+ log.LogDebug(string.Format("ApplicationContext Refresh: Preinstantiating singletons"));
}
objectFactory.PreInstantiateSingletons();
@@ -920,7 +918,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Information))
{
- log.Info(string.Format("ApplicationContext Refresh: Completed"));
+ log.LogInformation(string.Format("ApplicationContext Refresh: Completed"));
}
}
}
@@ -2338,10 +2336,10 @@ namespace Spring.Context.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
- CultureInfo.InvariantCulture,
- "Publishing event in context [{0}] : {1}",
- Name, e));
+ log.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "Publishing event in context [{0}] : {1}",
+ Name, e));
}
OnContextEvent(sender, e);
@@ -2375,9 +2373,9 @@ namespace Spring.Context.Support
{
if (log.IsEnabled(LogLevel.Information))
{
- log.Info(string.Format(
- "Object '{0}' is not eligible for being processed by all " +
- "IObjectPostProcessors (for example: not eligible for auto-proxying).", objectName));
+ log.LogInformation(string.Format(
+ "Object '{0}' is not eligible for being processed by all " +
+ "IObjectPostProcessors (for example: not eligible for auto-proxying).", objectName));
}
}
return obj;
diff --git a/src/Spring/Spring.Core/Context/Support/AbstractXmlApplicationContext.cs b/src/Spring/Spring.Core/Context/Support/AbstractXmlApplicationContext.cs
index 0a4f644c..9d60396e 100644
--- a/src/Spring/Spring.Core/Context/Support/AbstractXmlApplicationContext.cs
+++ b/src/Spring/Spring.Core/Context/Support/AbstractXmlApplicationContext.cs
@@ -148,10 +148,9 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Refreshed ObjectFactory for application context '{0}'.",
- Name));
+ log.LogDebug(string.Format(
+ "Refreshed ObjectFactory for application context '{0}'.",
+ Name));
}
#endregion
diff --git a/src/Spring/Spring.Core/Context/Support/ContextHandler.cs b/src/Spring/Spring.Core/Context/Support/ContextHandler.cs
index 14168b7a..680fda64 100644
--- a/src/Spring/Spring.Core/Context/Support/ContextHandler.cs
+++ b/src/Spring/Spring.Core/Context/Support/ContextHandler.cs
@@ -264,7 +264,7 @@ namespace Spring.Context.Support
}
#region Instrumentation
- if (Log.IsEnabled(LogLevel.Debug)) Log.Debug(string.Format("creating context '{0}'", contextName ) );
+ if (Log.IsEnabled(LogLevel.Debug)) Log.LogDebug(string.Format("creating context '{0}'", contextName ));
#endregion
IApplicationContext context = null;
@@ -293,7 +293,7 @@ namespace Spring.Context.Support
IList childContexts = GetChildContexts(contextElement);
CreateChildContexts(context, configContext, childContexts);
- if (Log.IsEnabled(LogLevel.Debug)) Log.Debug( string.Format("context '{0}' created for name '{1}'", context, contextName) );
+ if (Log.IsEnabled(LogLevel.Debug)) Log.LogDebug(string.Format("context '{0}' created for name '{1}'", context, contextName));
}
catch (Exception ex)
{
diff --git a/src/Spring/Spring.Core/Context/Support/ContextRegistry.cs b/src/Spring/Spring.Core/Context/Support/ContextRegistry.cs
index 37fbca2c..29b8f2d6 100644
--- a/src/Spring/Spring.Core/Context/Support/ContextRegistry.cs
+++ b/src/Spring/Spring.Core/Context/Support/ContextRegistry.cs
@@ -174,7 +174,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(String.Format("Registering context '{0}' under name '{1}'.", context, context.Name));
+ log.LogDebug(String.Format("Registering context '{0}' under name '{1}'.", context, context.Name));
}
#endregion
@@ -290,7 +290,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(String.Format(
+ log.LogDebug(String.Format(
"Returning context '{0}' registered under name '{1}'.", ctx, name));
}
@@ -326,9 +326,8 @@ namespace Spring.Context.Support
{
if (instance.contextMap.Count > 0)
{
- log.Warn(
- String.Format(
- "Not all contexts were removed from registry during cleanup - did you forget to call base.Dispose() when overriding AbstractApplicationContext.Dispose()?"));
+ log.LogWarning(String.Format(
+ "Not all contexts were removed from registry during cleanup - did you forget to call base.Dispose() when overriding AbstractApplicationContext.Dispose()?"));
}
}
diff --git a/src/Spring/Spring.Core/Core/IO/AssemblyResource.cs b/src/Spring/Spring.Core/Core/IO/AssemblyResource.cs
index 78395f45..aa2beb84 100644
--- a/src/Spring/Spring.Core/Core/IO/AssemblyResource.cs
+++ b/src/Spring/Spring.Core/Core/IO/AssemblyResource.cs
@@ -22,6 +22,7 @@
using System.Globalization;
using System.Reflection;
+using Microsoft.Extensions.Logging;
#endregion
@@ -129,10 +130,10 @@ namespace Spring.Core.IO
Stream stream = _assembly.GetManifestResourceStream(_resourceName);
if (stream == null)
{
- log.Error("Could not load resource with name = [" + _resourceName +
- "] from assembly + " + _assembly);
- log.Error("URI specified = [" + this._fullResourceName + "] Spring.NET URI syntax is 'assembly://assemblyName/namespace/resourceName'.");
- log.Error("Resource name often has the default namespace prefixed, e.g. 'assembly://MyAssembly/MyNamespace/MyNamespace.MyResource.txt'.");
+ log.LogError("Could not load resource with name = [" + _resourceName +
+ "] from assembly + " + _assembly);
+ log.LogError("URI specified = [" + this._fullResourceName + "] Spring.NET URI syntax is 'assembly://assemblyName/namespace/resourceName'.");
+ log.LogError("Resource name often has the default namespace prefixed, e.g. 'assembly://MyAssembly/MyNamespace/MyNamespace.MyResource.txt'.");
}
return stream;
}
diff --git a/src/Spring/Spring.Core/Core/IO/ResourceConverter.cs b/src/Spring/Spring.Core/Core/IO/ResourceConverter.cs
index 92f79ca1..4c67d87b 100644
--- a/src/Spring/Spring.Core/Core/IO/ResourceConverter.cs
+++ b/src/Spring/Spring.Core/Core/IO/ResourceConverter.cs
@@ -184,10 +184,10 @@ namespace Spring.Core.IO
if (_log.IsEnabled(LogLevel.Warning))
{
- _log.Warn(string.Format(
- CultureInfo.InvariantCulture,
- "Could not resolve placeholder '{0}' in resource path " +
- "'{1}' as an environment variable.", expression, path));
+ _log.LogWarning(string.Format(
+ CultureInfo.InvariantCulture,
+ "Could not resolve placeholder '{0}' in resource path " +
+ "'{1}' as an environment variable.", expression, path));
}
#endregion
diff --git a/src/Spring/Spring.Core/DataBinding/AbstractSimpleBinding.cs b/src/Spring/Spring.Core/DataBinding/AbstractSimpleBinding.cs
index 325f38f0..153767b6 100644
--- a/src/Spring/Spring.Core/DataBinding/AbstractSimpleBinding.cs
+++ b/src/Spring/Spring.Core/DataBinding/AbstractSimpleBinding.cs
@@ -1,4 +1,5 @@
using System.Reflection;
+using Microsoft.Extensions.Logging;
using Spring.Globalization;
using Spring.Validation;
@@ -132,7 +133,7 @@ namespace Spring.DataBinding
}
catch (Exception ex)
{
- log.Warn(string.Format("Failed binding[{0}]:{1}", this.Id, ex));
+ log.LogWarning(string.Format("Failed binding[{0}]:{1}", this.Id, ex));
if (!SetInvalid(validationErrors)) throw;
}
}
diff --git a/src/Spring/Spring.Core/Globalization/Localizers/ResourceSetLocalizer.cs b/src/Spring/Spring.Core/Globalization/Localizers/ResourceSetLocalizer.cs
index d4ca3bb7..9d5db1a7 100644
--- a/src/Spring/Spring.Core/Globalization/Localizers/ResourceSetLocalizer.cs
+++ b/src/Spring/Spring.Core/Globalization/Localizers/ResourceSetLocalizer.cs
@@ -21,6 +21,7 @@
using System.Collections;
using System.Globalization;
using System.Resources;
+using Microsoft.Extensions.Logging;
using Spring.Context;
using Spring.Context.Support;
using Spring.Expressions;
@@ -75,7 +76,7 @@ namespace Spring.Globalization.Localizers
catch (MissingManifestResourceException mmrex)
{
// ignore but log missing ResourceSet
- log.Debug("No ResourceSet available for invariant culture", mmrex);
+ log.LogDebug(mmrex, "No ResourceSet available for invariant culture");
}
if (invariantResources != null)
diff --git a/src/Spring/Spring.Core/LogManager.cs b/src/Spring/Spring.Core/LogManager.cs
index aa452699..b3811c53 100644
--- a/src/Spring/Spring.Core/LogManager.cs
+++ b/src/Spring/Spring.Core/LogManager.cs
@@ -32,16 +32,3 @@ public static class LogManager
public static ILogger GetLogger(Type type) => LoggerFactory?.CreateLogger(type) ?? NullLogger.Instance;
public static ILogger GetLogger() => LoggerFactory?.CreateLogger() ?? NullLogger.Instance;
}
-
-// TODO INLINE AND REMOVE
-public static class LoggerExtensions
-{
- public static void Debug(this ILogger logger, string message) => logger.LogDebug(message);
- public static void Debug(this ILogger logger, string message, Exception exception) => logger.LogDebug(exception, message);
- public static void Trace(this ILogger logger, string message) => logger.LogTrace(message);
- public static void Info(this ILogger logger, string message) => logger.LogInformation(message);
- public static void Warn(this ILogger logger, string message) => logger.LogWarning(message);
- public static void Warn(this ILogger logger, string message, Exception exception) => logger.LogWarning(exception, message);
- public static void Error(this ILogger logger, string message) => logger.LogError(message);
- public static void Error(this ILogger logger, string message, Exception exception) => logger.LogError(exception, message);
-}
diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/PropertyOverrideConfigurer.cs b/src/Spring/Spring.Core/Objects/Factory/Config/PropertyOverrideConfigurer.cs
index 11e222fb..04f3160c 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Config/PropertyOverrideConfigurer.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Config/PropertyOverrideConfigurer.cs
@@ -176,8 +176,8 @@ namespace Spring.Objects.Factory.Config
if (_logger.IsEnabled(LogLevel.Warning))
{
- _logger.Warn(string.Format(CultureInfo.InvariantCulture,
- "Cannot find object '{0}' when overriding properties; check configuration.", name));
+ _logger.LogWarning(string.Format(CultureInfo.InvariantCulture,
+ "Cannot find object '{0}' when overriding properties; check configuration.", name));
}
#endregion
@@ -187,8 +187,8 @@ namespace Spring.Objects.Factory.Config
if (_logger.IsEnabled(LogLevel.Debug))
{
- _logger.Debug(string.Format(CultureInfo.InvariantCulture,
- "Property '{0}' set to '{1}'.", key, value));
+ _logger.LogDebug(string.Format(CultureInfo.InvariantCulture,
+ "Property '{0}' set to '{1}'.", key, value));
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/PropertyPlaceholderConfigurer.cs b/src/Spring/Spring.Core/Objects/Factory/Config/PropertyPlaceholderConfigurer.cs
index de70e5ca..2bc5dd34 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Config/PropertyPlaceholderConfigurer.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Config/PropertyPlaceholderConfigurer.cs
@@ -304,9 +304,9 @@ namespace Spring.Objects.Factory.Config
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format(
- CultureInfo.InvariantCulture,
- "Resolving placeholder '{0}' to '{1}'.", placeholder, resolvedValue));
+ logger.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "Resolving placeholder '{0}' to '{1}'.", placeholder, resolvedValue));
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/PropertyResourceConfigurer.cs b/src/Spring/Spring.Core/Objects/Factory/Config/PropertyResourceConfigurer.cs
index 9b8a3a64..e2a569ca 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Config/PropertyResourceConfigurer.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Config/PropertyResourceConfigurer.cs
@@ -272,9 +272,9 @@ namespace Spring.Objects.Factory.Config
if (_log.IsEnabled(LogLevel.Debug))
{
- _log.Debug(string.Format(
- CultureInfo.InvariantCulture,
- "Loading configuration from '{0}'.", resource));
+ _log.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "Loading configuration from '{0}'.", resource));
}
#endregion
@@ -301,7 +301,7 @@ namespace Spring.Objects.Factory.Config
if (_log.IsEnabled(LogLevel.Warning))
{
- _log.Warn(errorMessage);
+ _log.LogWarning(errorMessage);
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/VariablePlaceholderConfigurer.cs b/src/Spring/Spring.Core/Objects/Factory/Config/VariablePlaceholderConfigurer.cs
index dd53665d..f62d654c 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Config/VariablePlaceholderConfigurer.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Config/VariablePlaceholderConfigurer.cs
@@ -301,9 +301,9 @@ namespace Spring.Objects.Factory.Config
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug(string.Format(
- CultureInfo.InvariantCulture,
- "Resolving placeholder '{0}' to '{1}'.", placeholder, resolvedValue));
+ logger.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "Resolving placeholder '{0}' to '{1}'.", placeholder, resolvedValue));
}
if (resolvedValue == null
diff --git a/src/Spring/Spring.Core/Objects/Factory/Parsing/FailFastProblemReporter.cs b/src/Spring/Spring.Core/Objects/Factory/Parsing/FailFastProblemReporter.cs
index ff4e70d7..e40d5970 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Parsing/FailFastProblemReporter.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Parsing/FailFastProblemReporter.cs
@@ -33,7 +33,7 @@ namespace Spring.Objects.Factory.Parsing
public void Error(Problem problem)
{
- _logger.Error(problem.Message);
+ _logger.LogError(problem.Message);
throw new ObjectDefinitionParsingException(problem);
}
@@ -45,7 +45,7 @@ namespace Spring.Objects.Factory.Parsing
public void Warning(Problem problem)
{
- _logger.Warn(problem.Message);
+ _logger.LogWarning(problem.Message);
}
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs
index bd41362c..c8619a2c 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractAutowireCapableObjectFactory.cs
@@ -239,7 +239,7 @@ namespace Spring.Objects.Factory.Support
RootObjectDefinition definition = GetMergedObjectDefinition(name, true);
if (definition != null)
{
- log.Debug($"configuring object '{instance}' using definition '{name}'");
+ log.LogDebug($"configuring object '{instance}' using definition '{name}'");
ApplyPropertyValues(name, definition, new ObjectWrapper(instance), definition.PropertyValues);
}
}
@@ -291,8 +291,8 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Invoking IInstantiationAwareObjectPostProcessors before " +
- $"the instantiation of '{objectName}'.");
+ log.LogDebug("Invoking IInstantiationAwareObjectPostProcessors before " +
+ $"the instantiation of '{objectName}'.");
}
for (var i = 0; i < objectPostProcessors.Count; i++)
@@ -658,19 +658,17 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(CultureInfo.InvariantCulture,
- "Added autowiring by name from object name '{0}' via " + "property '{1}' to object named '{1}'.", name,
- propertyName));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture,
+ "Added autowiring by name from object name '{0}' via " + "property '{1}' to object named '{1}'.", name,
+ propertyName));
}
}
else
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(CultureInfo.InvariantCulture,
- "Not autowiring property '{0}' of object '{1}' by name: " + "no matching object found.", propertyName, name));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture,
+ "Not autowiring property '{0}' of object '{1}' by name: " + "no matching object found.", propertyName, name));
}
}
}
@@ -714,10 +712,9 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(CultureInfo.InvariantCulture,
- "Autowiring by type from object name '{0}' via property " + "'{1}' to object named '{2}'.", name,
- propertyName, ObjectUtils.EnumerateFirstElement(matchingObjects.Keys)));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture,
+ "Autowiring by type from object name '{0}' via property " + "'{1}' to object named '{2}'.", name,
+ propertyName, ObjectUtils.EnumerateFirstElement(matchingObjects.Keys)));
}
}
else if (matchingObjects != null && matchingObjects.Count > 1)
@@ -733,9 +730,8 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(CultureInfo.InvariantCulture, "Not autowiring property '{0}' of object '{1}': no matching object found.",
- propertyName, name));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture, "Not autowiring property '{0}' of object '{1}': no matching object found.",
+ propertyName, name));
}
}
}
@@ -847,7 +843,7 @@ namespace Spring.Objects.Factory.Support
var isDebugEnabled = log.IsEnabled(LogLevel.Debug);
if (isDebugEnabled)
{
- log.Debug($"Creating instance of Object '{name}' with merged definition [{definition}].");
+ log.LogDebug($"Creating instance of Object '{name}' with merged definition [{definition}].");
}
// Make sure object type is actually resolved at this point.
@@ -892,7 +888,7 @@ namespace Spring.Objects.Factory.Support
{
if (isDebugEnabled)
{
- log.Debug($"Eagerly caching object '{name}' to allow for resolving potential circular references");
+ log.LogDebug($"Eagerly caching object '{name}' to allow for resolving potential circular references");
}
AddEagerlyCachedSingleton(name, definition, instance);
eagerlyCached = true;
@@ -1259,7 +1255,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(CultureInfo.InvariantCulture, "Calling AfterPropertiesSet() on object with name '{0}'.", name));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture, "Calling AfterPropertiesSet() on object with name '{0}'.", name));
}
((IInitializingObject)target).AfterPropertiesSet();
@@ -1268,9 +1264,8 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(CultureInfo.InvariantCulture, "Calling custom init method '{0} on object with name '{1}'.",
- definition.InitMethodName, name));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture, "Calling custom init method '{0} on object with name '{1}'.",
+ definition.InitMethodName, name));
}
try
@@ -1328,7 +1323,7 @@ namespace Spring.Objects.Factory.Support
}
if (targetMethod == null)
{
- log.Error("Couldn't find a method named '" + destroyMethodName + "' on object with name '" + name + "'");
+ log.LogError("Couldn't find a method named '" + destroyMethodName + "' on object with name '" + name + "'");
}
else
{
@@ -1339,7 +1334,8 @@ namespace Spring.Objects.Factory.Support
}
catch (TargetInvocationException ex)
{
- log.Error("Couldn't invoke destroy method '" + destroyMethodName + "' of object with name '" + name + "'", ex.GetBaseException());
+ string message = "Couldn't invoke destroy method '" + destroyMethodName + "' of object with name '" + name + "'";
+ log.LogError(ex.GetBaseException(), message);
}
catch (Exception ex)
{
@@ -1350,9 +1346,8 @@ namespace Spring.Objects.Factory.Support
private void LogExceptionRaisedByCustomDestroyMethodInvocation(string destroyMethodName, string name, Exception ex)
{
- log.Error(
- string.Format(CultureInfo.InvariantCulture, "Couldn't invoke destroy method '{0}' of object with name '{1}'.", destroyMethodName, name),
- ex);
+ string message = string.Format(CultureInfo.InvariantCulture, "Couldn't invoke destroy method '{0}' of object with name '{1}'.", destroyMethodName, name);
+ log.LogError(ex, message);
}
///
@@ -1631,9 +1626,8 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(CultureInfo.InvariantCulture, "Resolving reference from property '{0}' in object '{1}' to object '{2}'.",
- argumentName, name, reference.ObjectName));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture, "Resolving reference from property '{0}' in object '{1}' to object '{2}'.",
+ argumentName, name, reference.ObjectName));
}
try
@@ -1759,7 +1753,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"Configuring object using definition '{name}'");
+ log.LogDebug($"Configuring object using definition '{name}'");
}
PopulateObject(name, definition, wrapper);
@@ -1769,7 +1763,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"Setting the name property on the IObjectNameAware object '{name}'.");
+ log.LogDebug($"Setting the name property on the IObjectNameAware object '{name}'.");
}
((IObjectNameAware)instance).ObjectName = name;
@@ -1779,8 +1773,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- $"Setting the ObjectFactory property on the IObjectFactoryAware object '{name}'.");
+ log.LogDebug($"Setting the ObjectFactory property on the IObjectFactoryAware object '{name}'.");
}
((IObjectFactoryAware)instance).ObjectFactory = this;
@@ -1896,7 +1889,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"Invoking IObjectPostProcessors before initialization of object '{name}'");
+ log.LogDebug($"Invoking IObjectPostProcessors before initialization of object '{name}'");
}
object result = instance;
@@ -1938,7 +1931,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"Invoking IObjectPostProcessors after initialization of object '{name}'");
+ log.LogDebug($"Invoking IObjectPostProcessors after initialization of object '{name}'");
}
object result = instance;
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectDefinitionReader.cs b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectDefinitionReader.cs
index 6cf2ee17..180150cf 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectDefinitionReader.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectDefinitionReader.cs
@@ -228,7 +228,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Loaded " + loadCount + " object definitions from location [" + location + "]");
+ log.LogDebug("Loaded " + loadCount + " object definitions from location [" + location + "]");
}
return loadCount;
}
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs
index e4b34d72..04ac5286 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/AbstractObjectFactory.cs
@@ -739,8 +739,8 @@ namespace Spring.Objects.Factory.Support
}
catch (Exception ex)
{
- log.Warn("FactoryObject threw exception from ObjectType, despite the contract saying " +
- "that it should return null if the type of its object cannot be determined yet", ex);
+ log.LogWarning(ex, "FactoryObject threw exception from ObjectType, despite the contract saying " +
+ "that it should return null if the type of its object cannot be determined yet");
return null;
}
}
@@ -774,7 +774,7 @@ namespace Spring.Objects.Factory.Support
catch (ObjectCreationException ex)
{
// Can only happen when getting a FactoryObject.
- log.Warn("Ignoring object creation exception on FactoryObject type check", ex);
+ log.LogWarning(ex, "Ignoring object creation exception on FactoryObject type check");
return null;
}
}
@@ -877,7 +877,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Calling code asked for normal instance for name '{0}'.", canonicalName));
+ log.LogDebug(string.Format("Calling code asked for normal instance for name '{0}'.", canonicalName));
}
return instance;
@@ -888,9 +888,8 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format("Calling code asked for IFactoryObject instance for name '{0}'.",
- TransformedObjectName(name)));
+ log.LogDebug(string.Format("Calling code asked for IFactoryObject instance for name '{0}'.",
+ TransformedObjectName(name)));
}
return instance;
@@ -898,7 +897,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Object with name '{0}' is a factory object.", canonicalName));
+ log.LogDebug(string.Format("Object with name '{0}' is a factory object.", canonicalName));
}
object resultInstance = null;
@@ -912,7 +911,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Dereferencing Object with name '{0}'", canonicalName));
+ log.LogDebug(string.Format("Dereferencing Object with name '{0}'", canonicalName));
}
// return object instance from factory...
@@ -954,7 +953,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Returning factory product from cache for Object with name '{0}'", canonicalName));
+ log.LogDebug(string.Format("Returning factory product from cache for Object with name '{0}'", canonicalName));
}
}
return resultInstance;
@@ -1001,7 +1000,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Factory object with name '{0}' is configurable.", TransformedObjectName(objectName)));
+ log.LogDebug(string.Format("Factory object with name '{0}' is configurable.", TransformedObjectName(objectName)));
}
if (configurableFactory.ProductTemplate != null)
@@ -2107,7 +2106,7 @@ namespace Spring.Objects.Factory.Support
if (isDebugEnabled)
{
- log.Debug(string.Format("{2}GetObjectInternal: obtaining instance for name {0} => canonical name {1}", name, objectName, new string(' ', nestingCount * indent)));
+ log.LogDebug(string.Format("{2}GetObjectInternal: obtaining instance for name {0} => canonical name {1}", name, objectName, new string(' ', nestingCount * indent)));
}
object instance;
@@ -2123,12 +2122,12 @@ namespace Spring.Objects.Factory.Support
{
if (IsSingletonCurrentlyInCreation(objectName))
{
- log.Debug("Returning eagerly cached instance of singleton object '" + objectName +
- "' that is not fully initialized yet - a consequence of a circular reference");
+ log.LogDebug("Returning eagerly cached instance of singleton object '" + objectName +
+ "' that is not fully initialized yet - a consequence of a circular reference");
}
else
{
- log.Debug($"Returning cached instance of singleton object '{objectName}'.");
+ log.LogDebug($"Returning cached instance of singleton object '{objectName}'.");
}
}
@@ -2227,7 +2226,7 @@ namespace Spring.Objects.Factory.Support
hasErrors = true;
if (log.IsEnabled(LogLevel.Error))
{
- log.Error(string.Format("{1}GetObjectInternal: error obtaining object {0}", name, new string(' ', nestingCount * indent)));
+ log.LogError(string.Format("{1}GetObjectInternal: error obtaining object {0}", name, new string(' ', nestingCount * indent)));
}
throw;
@@ -2246,7 +2245,7 @@ namespace Spring.Objects.Factory.Support
if (isDebugEnabled)
{
- log.Debug(string.Format("{1}GetObjectInternal: returning instance for objectname {0}", name, new string(' ', nestingCount * indent)));
+ log.LogDebug(string.Format("{1}GetObjectInternal: returning instance for objectname {0}", name, new string(' ', nestingCount * indent)));
}
}
}
@@ -2328,7 +2327,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Creating shared instance of singleton object '{0}'", objectName));
+ log.LogDebug(string.Format("Creating shared instance of singleton object '{0}'", objectName));
}
BeforeSingletonCreation(objectName);
@@ -2344,7 +2343,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Cached shared instance of singleton object '{0}'", objectName));
+ log.LogDebug(string.Format("Cached shared instance of singleton object '{0}'", objectName));
}
}
return sharedInstance;
@@ -2372,7 +2371,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Destroying singletons in factory [{0}].", this));
+ log.LogDebug(string.Format("Destroying singletons in factory [{0}].", this));
}
prototypesInCreation.Dispose();
@@ -2524,8 +2523,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- $"Ignoring attempt to Register alias '{alias}' for object with name '{name}' because name and alias would be the same value.");
+ log.LogDebug($"Ignoring attempt to Register alias '{alias}' for object with name '{name}' because name and alias would be the same value.");
}
return;
@@ -2533,7 +2531,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"Registering alias '{alias}' for object with name '{name}'.");
+ log.LogDebug($"Registering alias '{alias}' for object with name '{name}'.");
}
object registeredName = aliasMap[alias];
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/ConstructorResolver.cs b/src/Spring/Spring.Core/Objects/Factory/Support/ConstructorResolver.cs
index e8792e91..97a3b0ff 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/ConstructorResolver.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/ConstructorResolver.cs
@@ -93,8 +93,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- $"Object '{objectName}' instantiated via constructor [{constructorInstantiationInfo.ConstructorInfo}].");
+ log.LogDebug($"Object '{objectName}' instantiated via constructor [{constructorInstantiationInfo.ConstructorInfo}].");
}
return wrapper;
@@ -349,7 +348,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"Object '{name}' instantiated via factory method [{factoryMethodCandidate}].");
+ log.LogDebug($"Object '{name}' instantiated via factory method [{factoryMethodCandidate}].");
}
return wrapper;
@@ -476,8 +475,7 @@ namespace Spring.Objects.Factory.Support
for (var i = 0; i < autowiredObjectNames.Count; i++)
{
string autowiredObjectName = autowiredObjectNames[i];
- log.Debug(
- $"Autowiring by type from object name '{objectName}' via {GetMethodType()} to object named '{autowiredObjectName}'");
+ log.LogDebug($"Autowiring by type from object name '{objectName}' via {GetMethodType()} to object named '{autowiredObjectName}'");
}
}
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/DefaultListableObjectFactory.cs b/src/Spring/Spring.Core/Objects/Factory/Support/DefaultListableObjectFactory.cs
index 1ea475f5..963434e5 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/DefaultListableObjectFactory.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/DefaultListableObjectFactory.cs
@@ -365,8 +365,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- $"Overriding object definition for object '{name}': replacing [{existingDefinition}] with [{objectDefinition}].");
+ log.LogDebug($"Overriding object definition for object '{name}': replacing [{existingDefinition}] with [{objectDefinition}].");
}
objectDefinitionMap[name] = objectDefinition;
}
@@ -467,7 +466,7 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Pre-instantiating singletons in factory [" + this + "]");
+ log.LogDebug("Pre-instantiating singletons in factory [" + this + "]");
}
try
@@ -513,9 +512,7 @@ namespace Spring.Objects.Factory.Support
}
catch (Exception ex)
{
- log.Error(
- "PreInstantiateSingletons failed but couldn't destroy any already-created singletons.",
- ex);
+ log.LogError(ex, "PreInstantiateSingletons failed but couldn't destroy any already-created singletons.");
}
throw;
}
@@ -995,10 +992,11 @@ namespace Spring.Objects.Factory.Support
// created object itself...
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
+ string message = string.Format(
CultureInfo.InvariantCulture,
"Ignoring match to currently created object '{0}'.",
- objectName), ex);
+ objectName);
+ log.LogDebug(ex, message);
}
}
else
@@ -1182,7 +1180,8 @@ namespace Spring.Objects.Factory.Support
// Probably contains a placeholder; lets ignore it for type matching purposes.
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Ignoring object class loading failure for object '" + objectName + "'", ex);
+ string message = "Ignoring object class loading failure for object '" + objectName + "'";
+ log.LogDebug(ex, message);
}
}
catch (ObjectDefinitionStoreException ex)
@@ -1195,7 +1194,8 @@ namespace Spring.Objects.Factory.Support
// Probably contains a placeholder; lets ignore it for type matching purposes.
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Ignoring unresolvable metadata in object definition '" + objectName + "'", ex);
+ string message = "Ignoring unresolvable metadata in object definition '" + objectName + "'";
+ log.LogDebug(ex, message);
}
}
}
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/DisposableObjectAdapter.cs b/src/Spring/Spring.Core/Objects/Factory/Support/DisposableObjectAdapter.cs
index 199d3f0e..240132fa 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/DisposableObjectAdapter.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/DisposableObjectAdapter.cs
@@ -136,7 +136,7 @@ namespace Spring.Objects.Factory.Support
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Invoking Dispose() on object with name '" + this.objectName + "'");
+ logger.LogDebug("Invoking Dispose() on object with name '" + this.objectName + "'");
}
try
{
@@ -149,11 +149,11 @@ namespace Spring.Objects.Factory.Support
string msg = "Invocation of Dispose method failed on object with name '" + this.objectName + "'";
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Warn(msg, ex);
+ logger.LogWarning(ex, msg);
}
else
{
- logger.Warn(msg + ": " + ex);
+ logger.LogWarning(msg + ": " + ex);
}
}
}
@@ -217,8 +217,8 @@ namespace Spring.Objects.Factory.Support
}
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Invoking destroy method '" + this.destroyMethodName +
- "' on object with name '" + this.objectName + "'");
+ logger.LogDebug("Invoking destroy method '" + this.destroyMethodName +
+ "' on object with name '" + this.objectName + "'");
}
try
{
@@ -231,17 +231,18 @@ namespace Spring.Objects.Factory.Support
"' failed on object with name '" + this.objectName + "'";
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Warn(msg, ex.InnerException);
+ logger.LogWarning(ex.InnerException, msg);
}
else
{
- logger.Warn(msg + ": " + ex.InnerException);
+ logger.LogWarning(msg + ": " + ex.InnerException);
}
}
catch (Exception ex)
{
- logger.Error("Couldn't invoke destroy method '" + this.destroyMethodName +
- "' on object with name '" + this.objectName + "'", ex);
+ string message = "Couldn't invoke destroy method '" + this.destroyMethodName +
+ "' on object with name '" + this.objectName + "'";
+ logger.LogError(ex, message);
}
}
}
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/MethodInjectingInstantiationStrategy.cs b/src/Spring/Spring.Core/Objects/Factory/Support/MethodInjectingInstantiationStrategy.cs
index ea394db0..856ee1c3 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/MethodInjectingInstantiationStrategy.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/MethodInjectingInstantiationStrategy.cs
@@ -189,10 +189,10 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(CultureInfo.InvariantCulture,
- "Generating a subclass of the [{0}] class for the '{1}' " +
- "object definition for the purposes of method injection.",
- definition.ObjectType, objectName));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture,
+ "Generating a subclass of the [{0}] class for the '{1}' " +
+ "object definition for the purposes of method injection.",
+ definition.ObjectType, objectName));
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/ObjectDefinitionValueResolver.cs b/src/Spring/Spring.Core/Objects/Factory/Support/ObjectDefinitionValueResolver.cs
index 3360f676..af7178eb 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/ObjectDefinitionValueResolver.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/ObjectDefinitionValueResolver.cs
@@ -345,9 +345,8 @@ namespace Spring.Objects.Factory.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(CultureInfo.InvariantCulture, "Resolving reference from property '{0}' in object '{1}' to object '{2}'.",
- argumentName, name, reference.ObjectName));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture, "Resolving reference from property '{0}' in object '{1}' to object '{2}'.",
+ argumentName, name, reference.ObjectName));
}
try
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/PropertiesObjectDefinitionReader.cs b/src/Spring/Spring.Core/Objects/Factory/Support/PropertiesObjectDefinitionReader.cs
index 90c6fde8..911d2eae 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/PropertiesObjectDefinitionReader.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/PropertiesObjectDefinitionReader.cs
@@ -357,7 +357,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Found object name '" + name + "'");
+ log.LogDebug("Found object name '" + name + "'");
}
#endregion
@@ -377,7 +377,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Invalid object name and property [" + nameAndProperty + "]");
+ log.LogDebug("Invalid object name and property [" + nameAndProperty + "]");
}
#endregion
@@ -477,11 +477,11 @@ namespace Spring.Objects.Factory.Support
}
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(pvs.ToString());
+ log.LogDebug(pvs.ToString());
}
if (parent == null)
{
- log.Debug(this.DefaultParentObject);
+ log.LogDebug(this.DefaultParentObject);
parent = this.DefaultParentObject;
}
if (typeName == null && parent == null)
diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/SimpleInstantiationStrategy.cs b/src/Spring/Spring.Core/Objects/Factory/Support/SimpleInstantiationStrategy.cs
index bd2ad0f5..2f822d6e 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Support/SimpleInstantiationStrategy.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Support/SimpleInstantiationStrategy.cs
@@ -73,7 +73,7 @@ namespace Spring.Objects.Factory.Support
AssertUtils.ArgumentNotNull(definition, "definition");
AssertUtils.ArgumentNotNull(factory, "factory");
- if (log.IsEnabled(LogLevel.Trace)) log.Trace(string.Format("instantiating object '{0}'", name));
+ if (log.IsEnabled(LogLevel.Trace)) log.LogTrace(string.Format("instantiating object '{0}'", name));
if (definition.HasMethodOverrides)
{
@@ -201,7 +201,7 @@ namespace Spring.Objects.Factory.Support
if (log.IsEnabled(LogLevel.Warning))
{
- log.Warn(msg, ex.InnerException);
+ log.LogWarning(ex.InnerException, msg);
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/Factory/Xml/DefaultObjectDefinitionDocumentReader.cs b/src/Spring/Spring.Core/Objects/Factory/Xml/DefaultObjectDefinitionDocumentReader.cs
index e39549d5..a8e761b8 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Xml/DefaultObjectDefinitionDocumentReader.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Xml/DefaultObjectDefinitionDocumentReader.cs
@@ -83,7 +83,7 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Loading object definitions.");
+ log.LogDebug("Loading object definitions.");
}
XmlElement root = doc.DocumentElement;
@@ -99,8 +99,7 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- $"Found {readerContext.Registry.ObjectDefinitionCount} <{ObjectDefinitionConstants.ObjectElement}> elements defining objects.");
+ log.LogDebug($"Found {readerContext.Registry.ObjectDefinitionCount} <{ObjectDefinitionConstants.ObjectElement}> elements defining objects.");
}
}
@@ -190,7 +189,7 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(CultureInfo.InvariantCulture, "Registering object definition with id '{0}'.", bdHolder.ObjectName));
+ log.LogDebug(string.Format(CultureInfo.InvariantCulture, "Registering object definition with id '{0}'.", bdHolder.ObjectName));
}
ObjectDefinitionReaderUtils.RegisterObjectDefinition(bdHolder, ReaderContext.Registry);
@@ -223,9 +222,9 @@ namespace Spring.Objects.Factory.Xml
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
- CultureInfo.InvariantCulture,
- "Attempting to import object definitions from '{0}'.", location));
+ log.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "Attempting to import object definitions from '{0}'.", location));
}
IResource importResource = ReaderContext.Resource.CreateRelative(location);
diff --git a/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectDefinitionParserHelper.cs b/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectDefinitionParserHelper.cs
index 2f12ee3f..896b2a67 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectDefinitionParserHelper.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectDefinitionParserHelper.cs
@@ -110,7 +110,7 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Loading object definitions...");
+ log.LogDebug("Loading object definitions...");
}
#endregion
@@ -121,10 +121,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default lazy init '{0}'.",
- ddd.LazyInit));
+ log.LogDebug(string.Format(
+ "Default lazy init '{0}'.",
+ ddd.LazyInit));
}
#endregion
@@ -135,10 +134,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default dependency check '{0}'.",
- ddd.DependencyCheck));
+ log.LogDebug(string.Format(
+ "Default dependency check '{0}'.",
+ ddd.DependencyCheck));
}
#endregion
@@ -149,10 +147,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default autowire '{0}'.",
- ddd.Autowire));
+ log.LogDebug(string.Format(
+ "Default autowire '{0}'.",
+ ddd.Autowire));
}
#endregion
@@ -163,10 +160,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default merge '{0}'.",
- ddd.Merge));
+ log.LogDebug(string.Format(
+ "Default merge '{0}'.",
+ ddd.Merge));
}
#endregion
@@ -177,10 +173,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default init method '{0}'.",
- ddd.InitMethod));
+ log.LogDebug(string.Format(
+ "Default init method '{0}'.",
+ ddd.InitMethod));
}
#endregion
@@ -191,10 +186,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default destroy method '{0}'.",
- ddd.DestroyMethod));
+ log.LogDebug(string.Format(
+ "Default destroy method '{0}'.",
+ ddd.DestroyMethod));
}
#endregion
@@ -205,10 +199,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default autowire candidates '{0}'.",
- ddd.AutowireCandidates));
+ log.LogDebug(string.Format(
+ "Default autowire candidates '{0}'.",
+ ddd.AutowireCandidates));
}
#endregion
@@ -219,10 +212,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default init method '{0}'.",
- ddd.InitMethod));
+ log.LogDebug(string.Format(
+ "Default init method '{0}'.",
+ ddd.InitMethod));
}
#endregion
@@ -233,10 +225,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- "Default destroy method '{0}'.",
- ddd.DestroyMethod));
+ log.LogDebug(string.Format(
+ "Default destroy method '{0}'.",
+ ddd.DestroyMethod));
}
#endregion
@@ -341,7 +332,7 @@ namespace Spring.Objects.Factory.Xml
aliases.RemoveAt(0);
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("No XML 'id' specified using '{0}' as object name and '{1}' as aliases", objectName, string.Join(",", aliases.ToArray())));
+ log.LogDebug(string.Format("No XML 'id' specified using '{0}' as object name and '{1}' as aliases", objectName, string.Join(",", aliases.ToArray())));
}
}
}
@@ -382,9 +373,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
- "Neither XML '{0}' nor '{1}' specified - using generated object name [{2}]",
- ObjectDefinitionConstants.IdAttribute, ObjectDefinitionConstants.NameAttribute, objectName));
+ log.LogDebug(string.Format(
+ "Neither XML '{0}' nor '{1}' specified - using generated object name [{2}]",
+ ObjectDefinitionConstants.IdAttribute, ObjectDefinitionConstants.NameAttribute, objectName));
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs b/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs
index 0a084e43..b2fc0bee 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs
@@ -205,7 +205,7 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
+ log.LogDebug(string.Format(
CultureInfo.InvariantCulture,
"Attempting to import object definitions from '{0}'.", location));
}
@@ -313,10 +313,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format(
- CultureInfo.InvariantCulture,
- "Registering object definition with id '{0}'.", holder.ObjectName));
+ log.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "Registering object definition with id '{0}'.", holder.ObjectName));
}
#endregion
@@ -838,7 +837,7 @@ namespace Spring.Objects.Factory.Xml
{
if (log.IsEnabled(LogLevel.Warning))
{
- log.Warn("The 'type' attribute is redundant when the 'name' attribute has been used on a constructor argument element.");
+ log.LogWarning("The 'type' attribute is redundant when the 'name' attribute has been used on a constructor argument element.");
}
}
arguments.AddNamedArgumentValue(nameAttr, val);
@@ -1467,9 +1466,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format("Error while parsing dependency checking mode : '{0}' is an invalid value.",
- value), ex);
+ string message = string.Format("Error while parsing dependency checking mode : '{0}' is an invalid value.",
+ value);
+ log.LogDebug(ex, message);
}
#endregion
@@ -1509,9 +1508,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(
- string.Format("Error while parsing autowire mode : '{0}' is an invalid value.",
- value), ex);
+ string message = string.Format("Error while parsing autowire mode : '{0}' is an invalid value.",
+ value);
+ log.LogDebug(ex, message);
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/Factory/Xml/XmlObjectDefinitionReader.cs b/src/Spring/Spring.Core/Objects/Factory/Xml/XmlObjectDefinitionReader.cs
index e2b0758c..19b0d1fa 100644
--- a/src/Spring/Spring.Core/Objects/Factory/Xml/XmlObjectDefinitionReader.cs
+++ b/src/Spring/Spring.Core/Objects/Factory/Xml/XmlObjectDefinitionReader.cs
@@ -222,7 +222,7 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Loading XML object definitions from " + resource);
+ log.LogDebug("Loading XML object definitions from " + resource);
}
#endregion
@@ -252,7 +252,7 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Warning))
{
- log.Warn("Could not close stream.", ex);
+ log.LogWarning(ex, "Could not close stream.");
}
#endregion
@@ -340,7 +340,7 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Using the following XmlReader implementation : " + reader.GetType());
+ log.LogDebug("Using the following XmlReader implementation : " + reader.GetType());
}
return reader;
@@ -375,9 +375,8 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Warning))
{
- log.Warn(
- "Ignored XML validation warning: " + args.Message,
- args.Exception);
+ string message = "Ignored XML validation warning: " + args.Message;
+ log.LogWarning(args.Exception, message);
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/ObjectWrapper.cs b/src/Spring/Spring.Core/Objects/ObjectWrapper.cs
index 51f5d8c4..ec2133f9 100644
--- a/src/Spring/Spring.Core/Objects/ObjectWrapper.cs
+++ b/src/Spring/Spring.Core/Objects/ObjectWrapper.cs
@@ -17,7 +17,7 @@
using System.ComponentModel;
using System.Reflection;
using System.Text;
-
+using Microsoft.Extensions.Logging;
using Spring.Core;
using Spring.Expressions;
using Spring.Expressions.Parser.antlr;
@@ -312,7 +312,8 @@ namespace Spring.Objects
{
if (!ignoreUnknown)
{
- Log.Error($"Failed setting property '{pv.Name}'", ex);
+ string message = $"Failed setting property '{pv.Name}'";
+ Log.LogError(ex, message);
throw;
}
}
@@ -320,23 +321,27 @@ namespace Spring.Objects
{
if (!ignoreUnknown)
{
- Log.Error($"Failed setting property '{pv.Name}'", ex);
+ string message = $"Failed setting property '{pv.Name}'";
+ Log.LogError(ex, message);
throw;
}
}
catch (TypeMismatchException ex) // otherwise, just ignore it and continue...
{
- Log.Error($"Failed setting property '{pv.Name}'", ex);
+ string message = $"Failed setting property '{pv.Name}'";
+ Log.LogError(ex, message);
propertyAccessExceptions.Add(ex);
}
catch (MethodInvocationException ex)
{
- Log.Error($"Failed setting property '{pv.Name}'", ex);
+ string message = $"Failed setting property '{pv.Name}'";
+ Log.LogError(ex, message);
propertyAccessExceptions.Add(ex);
}
catch (Exception ex)
{
- Log.Error($"Failed setting property '{pv.Name}' on instance of type '{WrappedType.FullName}'", ex);
+ string message = $"Failed setting property '{pv.Name}' on instance of type '{WrappedType.FullName}'";
+ Log.LogError(ex, message);
throw;
}
}
diff --git a/src/Spring/Spring.Core/Objects/Support/AutoWiringEventHandlerValue.cs b/src/Spring/Spring.Core/Objects/Support/AutoWiringEventHandlerValue.cs
index 9f7c118c..bbc1605e 100644
--- a/src/Spring/Spring.Core/Objects/Support/AutoWiringEventHandlerValue.cs
+++ b/src/Spring/Spring.Core/Objects/Support/AutoWiringEventHandlerValue.cs
@@ -207,11 +207,11 @@ namespace Spring.Objects.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format(
- CultureInfo.InvariantCulture,
- "Wiring up this method '{0}' to this event '{1}'",
- method.Name,
- theEvent.Name));
+ log.LogDebug(string.Format(
+ CultureInfo.InvariantCulture,
+ "Wiring up this method '{0}' to this event '{1}'",
+ method.Name,
+ theEvent.Name));
}
#endregion
diff --git a/src/Spring/Spring.Core/Objects/Support/PropertyComparator.cs b/src/Spring/Spring.Core/Objects/Support/PropertyComparator.cs
index b6949af6..6d311547 100644
--- a/src/Spring/Spring.Core/Objects/Support/PropertyComparator.cs
+++ b/src/Spring/Spring.Core/Objects/Support/PropertyComparator.cs
@@ -121,8 +121,8 @@ namespace Spring.Objects.Support
if (logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("Could not sort objects [" + o1 + "] and [" + o2 + "]",
- ex);
+ string message = "Could not sort objects [" + o1 + "] and [" + o2 + "]";
+ logger.LogWarning(ex, message);
}
#endregion
@@ -163,7 +163,7 @@ namespace Spring.Objects.Support
// if a nested property cannot be read, simply return null...
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Could not access property - treating as null for sorting.", ex);
+ logger.LogDebug(ex, "Could not access property - treating as null for sorting.");
}
}
}
diff --git a/src/Spring/Spring.Core/Util/EventUtils.cs b/src/Spring/Spring.Core/Util/EventUtils.cs
index 36c03026..960e1675 100644
--- a/src/Spring/Spring.Core/Util/EventUtils.cs
+++ b/src/Spring/Spring.Core/Util/EventUtils.cs
@@ -20,7 +20,7 @@
using System.Diagnostics;
using System.Reflection;
-
+using Microsoft.Extensions.Logging;
namespace Spring.Util
{
@@ -154,7 +154,8 @@ namespace Spring.Util
}
catch(Exception ex)
{
- Log.Warn("Error during raising an event from " + new StackTrace(), ex);
+ string message = "Error during raising an event from " + new StackTrace();
+ Log.LogWarning(ex, message);
exceptions.Add(sink, ex);
}
}
diff --git a/src/Spring/Spring.Core/Util/ObjectUtils.cs b/src/Spring/Spring.Core/Util/ObjectUtils.cs
index 7b919c8f..cf24d0a1 100644
--- a/src/Spring/Spring.Core/Util/ObjectUtils.cs
+++ b/src/Spring/Spring.Core/Util/ObjectUtils.cs
@@ -206,7 +206,7 @@ namespace Spring.Util
{
AssertUtils.ArgumentNotNull(constructor, "constructor");
- if (log.IsEnabled(LogLevel.Trace)) log.Trace(string.Format("instantiating type [{0}] using constructor [{1}]", constructor.DeclaringType, constructor));
+ if (log.IsEnabled(LogLevel.Trace)) log.LogTrace(string.Format("instantiating type [{0}] using constructor [{1}]", constructor.DeclaringType, constructor));
if (constructor.DeclaringType.IsInterface)
{
diff --git a/src/Spring/Spring.Core/Validation/Actions/ExceptionAction.cs b/src/Spring/Spring.Core/Validation/Actions/ExceptionAction.cs
index 9e6311f9..f71784b5 100644
--- a/src/Spring/Spring.Core/Validation/Actions/ExceptionAction.cs
+++ b/src/Spring/Spring.Core/Validation/Actions/ExceptionAction.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Expressions;
namespace Spring.Validation.Actions
@@ -78,7 +79,8 @@ namespace Spring.Validation.Actions
}
catch (Exception e)
{
- log.Error("Was not able to evaluate action expression [" + throwsExpression + "]", e);
+ string message = "Was not able to evaluate action expression [" + throwsExpression + "]";
+ log.LogError(e, message);
}
Exception exception = o as Exception;
if (exception != null)
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/Bytecode/ProxyFactory.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/Bytecode/ProxyFactory.cs
index 8991b2a7..ebb11262 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/Bytecode/ProxyFactory.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/Bytecode/ProxyFactory.cs
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+using Microsoft.Extensions.Logging;
using NHibernate;
using NHibernate.Engine;
using NHibernate.Proxy;
@@ -66,7 +67,7 @@ namespace Spring.Data.NHibernate.Bytecode
}
catch (Exception ex)
{
- log.Error("Creating a proxy instance failed", ex);
+ log.LogError(ex, "Creating a proxy instance failed");
throw new HibernateException("Creating a proxy instance failed", ex);
}
}
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateAccessor.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateAccessor.cs
index ac5a3ca5..53363deb 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateAccessor.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateAccessor.cs
@@ -17,6 +17,7 @@
using System.Collections;
using System.Reflection;
using AopAlliance.Intercept;
+using Microsoft.Extensions.Logging;
using NHibernate;
using NHibernate.Impl;
using NHibernate.Type;
@@ -384,7 +385,7 @@ namespace Spring.Data.NHibernate
if (TemplateFlushMode == TemplateFlushMode.Eager ||
(!existingTransaction && TemplateFlushMode != TemplateFlushMode.Never))
{
- log.Debug("Eagerly flushing Hibernate session");
+ log.LogDebug("Eagerly flushing Hibernate session");
session.Flush();
}
}
@@ -467,7 +468,7 @@ namespace Spring.Data.NHibernate
}
else
{
- log.Warn("Could not set FetchSize for IQuery. Expected Implemention to be of type AbstractQueryImpl");
+ log.LogWarning("Could not set FetchSize for IQuery. Expected Implemention to be of type AbstractQueryImpl");
}
}
@@ -577,7 +578,7 @@ namespace Spring.Data.NHibernate
}
catch (TypeLoadException e)
{
- log.Warn("Can't set FetchSize for ICriteria", e);
+ log.LogWarning(e, "Can't set FetchSize for ICriteria");
}
}
@@ -598,7 +599,7 @@ namespace Spring.Data.NHibernate
}
catch (TypeLoadException e)
{
- log.Warn("CriteriaImpl not available. FetchSize can not be set on ICriteria objects", e);
+ log.LogWarning(e, "CriteriaImpl not available. FetchSize can not be set on ICriteria objects");
}
}
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTemplate.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTemplate.cs
index 1725bcbd..26ebd147 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTemplate.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTemplate.cs
@@ -855,7 +855,7 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Found thread-bound Session for HibernateTemplate");
+ log.LogDebug("Found thread-bound Session for HibernateTemplate");
}
}
@@ -903,7 +903,7 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Not closing pre-bound Hibernate Session after HibernateTemplate");
+ log.LogDebug("Not closing pre-bound Hibernate Session after HibernateTemplate");
}
if (previousFlushModeHolder.ModeWasSet)
{
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTransactionManager.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTransactionManager.cs
index a8aaf722..25acfc65 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTransactionManager.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTransactionManager.cs
@@ -282,8 +282,8 @@ namespace Spring.Data.NHibernate
(SessionHolder)TransactionSynchronizationManager.GetResource(SessionFactory);
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Found thread-bound Session [" + sessionHolder.Session +
- "] for Hibernate transaction");
+ log.LogDebug("Found thread-bound Session [" + sessionHolder.Session +
+ "] for Hibernate transaction");
}
txObject.SetSessionHolder(sessionHolder, false);
if (DbProvider != null)
@@ -359,7 +359,7 @@ namespace Spring.Data.NHibernate
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Opened new Session [" + newSession + "] for Hibernate transaction");
+ log.LogDebug("Opened new Session [" + newSession + "] for Hibernate transaction");
}
txObject.SetSessionHolder(new SessionHolder(newSession), true);
@@ -414,7 +414,7 @@ namespace Spring.Data.NHibernate
}
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Exposing Hibernate transaction as ADO transaction [" + con + "]");
+ log.LogDebug("Exposing Hibernate transaction as ADO transaction [" + con + "]");
}
TransactionSynchronizationManager.BindResource(DbProvider, conHolder);
txObject.ConnectionHolder = conHolder;
@@ -527,8 +527,8 @@ namespace Spring.Data.NHibernate
HibernateTransactionObject txObject = (HibernateTransactionObject)status.Transaction;
if (status.Debug)
{
- log.Debug("Committing Hibernate transaction on Session [" +
- txObject.SessionHolder.Session + "]");
+ log.LogDebug("Committing Hibernate transaction on Session [" +
+ txObject.SessionHolder.Session + "]");
}
try
{
@@ -570,8 +570,8 @@ namespace Spring.Data.NHibernate
if (status.Debug)
{
- log.Debug("Rolling back Hibernate transaction on Session [" +
- txObject.SessionHolder.Session + "]");
+ log.LogDebug("Rolling back Hibernate transaction on Session [" +
+ txObject.SessionHolder.Session + "]");
}
try
{
@@ -619,8 +619,8 @@ namespace Spring.Data.NHibernate
HibernateTransactionObject txObject = (HibernateTransactionObject)status.Transaction;
if (status.Debug)
{
- log.Debug("Setting Hibernate transaction on Session [" +
- txObject.SessionHolder.Session + "] rollback-only");
+ log.LogDebug("Setting Hibernate transaction on Session [" +
+ txObject.SessionHolder.Session + "] rollback-only");
}
txObject.SetRollbackOnly();
}
@@ -646,12 +646,12 @@ namespace Spring.Data.NHibernate
}
catch (Exception e)
{
- log.Warn("Could not extract IDbTransaction from Hibernate AdoTransaction using field name trans.", e);
+ log.LogWarning(e, "Could not extract IDbTransaction from Hibernate AdoTransaction using field name trans.");
}
}
else
{
- log.Warn("Hibernate ITransaction not of expected type AdoTransaction. Could not extract IDbTransaction from Hibernate AdoTransaction.");
+ log.LogWarning("Hibernate ITransaction not of expected type AdoTransaction. Could not extract IDbTransaction from Hibernate AdoTransaction.");
}
return adoTransaction;
}
@@ -731,7 +731,7 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Closing Hibernate Session [" + session + "] after transaction");
+ log.LogDebug("Closing Hibernate Session [" + session + "] after transaction");
}
SessionFactoryUtils.CloseSessionOrRegisterDeferredClose(session, SessionFactory);
}
@@ -739,7 +739,7 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Not closing pre-bound Hibernate Session [" + session + "] after transaction");
+ log.LogDebug("Not closing pre-bound Hibernate Session [" + session + "] after transaction");
}
if (txObject.SessionHolder.AssignedPreviousFlushMode)
{
@@ -938,14 +938,14 @@ namespace Spring.Data.NHibernate
// Use the SessionFactory's DataSource for exposing transactions to ADO.NET code.
if (log.IsEnabled(LogLevel.Information))
{
- log.Info("Derived DbProvider [" + sfDbProvider.DbMetadata.ProductName +
- "] of Hibernate SessionFactory for HibernateTransactionManager");
+ log.LogInformation("Derived DbProvider [" + sfDbProvider.DbMetadata.ProductName +
+ "] of Hibernate SessionFactory for HibernateTransactionManager");
}
DbProvider = sfDbProvider;
}
else
{
- log.Info("Could not auto detect DbProvider from SessionFactory configuration");
+ log.LogInformation("Could not auto detect DbProvider from SessionFactory configuration");
}
}
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTxScopeTransactionManager.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTxScopeTransactionManager.cs
index ee024124..22ee4c88 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTxScopeTransactionManager.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/HibernateTxScopeTransactionManager.cs
@@ -287,8 +287,8 @@ namespace Spring.Data.NHibernate
(SessionHolder)TransactionSynchronizationManager.GetResource(SessionFactory);
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Found thread-bound Session [" + sessionHolder.Session +
- "] for Hibernate transaction");
+ log.LogDebug("Found thread-bound Session [" + sessionHolder.Session +
+ "] for Hibernate transaction");
}
txObject.SetSessionHolder(sessionHolder, false);
if (DbProvider != null)
@@ -380,7 +380,7 @@ namespace Spring.Data.NHibernate
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Opened new Session [" + newSession + "] for Hibernate transaction");
+ log.LogDebug("Opened new Session [" + newSession + "] for Hibernate transaction");
}
txObject.SetSessionHolder(new SessionHolder(newSession), true);
@@ -435,7 +435,7 @@ namespace Spring.Data.NHibernate
}
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Exposing Hibernate transaction as ADO transaction [" + con + "]");
+ log.LogDebug("Exposing Hibernate transaction as ADO transaction [" + con + "]");
}
TransactionSynchronizationManager.BindResource(DbProvider, conHolder);
txObject.ConnectionHolder = conHolder;
@@ -617,8 +617,8 @@ namespace Spring.Data.NHibernate
HibernateTransactionObject txObject = (HibernateTransactionObject)status.Transaction;
if (status.Debug)
{
- log.Debug("Committing Hibernate transaction on Session [" +
- txObject.SessionHolder.Session + "]");
+ log.LogDebug("Committing Hibernate transaction on Session [" +
+ txObject.SessionHolder.Session + "]");
}
try
{
@@ -787,8 +787,8 @@ namespace Spring.Data.NHibernate
HibernateTransactionObject txObject = (HibernateTransactionObject)status.Transaction;
if (status.Debug)
{
- log.Debug("Setting Hibernate transaction on Session [" +
- txObject.SessionHolder.Session + "] rollback-only");
+ log.LogDebug("Setting Hibernate transaction on Session [" +
+ txObject.SessionHolder.Session + "] rollback-only");
}
txObject.SetRollbackOnly();
@@ -803,7 +803,7 @@ namespace Spring.Data.NHibernate
{
if (status.Debug)
{
- log.Debug("Setting transaction rollback-only");
+ log.LogDebug("Setting transaction rollback-only");
}
try
{
@@ -836,12 +836,12 @@ namespace Spring.Data.NHibernate
}
catch (Exception e)
{
- log.Warn("Could not extract IDbTransaction from Hibernate AdoTransaction using field name trans.", e);
+ log.LogWarning(e, "Could not extract IDbTransaction from Hibernate AdoTransaction using field name trans.");
}
}
else
{
- log.Warn("Hibernate ITransaction not of expected type AdoTransaction. Could not extract IDbTransaction from Hibernate AdoTransaction.");
+ log.LogWarning("Hibernate ITransaction not of expected type AdoTransaction. Could not extract IDbTransaction from Hibernate AdoTransaction.");
}
return adoTransaction;
}
@@ -933,7 +933,7 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Closing Hibernate Session [" + session + "] after transaction");
+ log.LogDebug("Closing Hibernate Session [" + session + "] after transaction");
}
SessionFactoryUtils.CloseSessionOrRegisterDeferredClose(session, SessionFactory);
@@ -942,7 +942,7 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Not closing pre-bound Hibernate Session [" + session + "] after transaction");
+ log.LogDebug("Not closing pre-bound Hibernate Session [" + session + "] after transaction");
}
if (txObject.SessionHolder.AssignedPreviousFlushMode)
{
@@ -1101,14 +1101,14 @@ namespace Spring.Data.NHibernate
// Use the SessionFactory's DataSource for exposing transactions to ADO.NET code.
if (log.IsEnabled(LogLevel.Information))
{
- log.Info("Derived DbProvider [" + sfDbProvider.DbMetadata.ProductName +
- "] of Hibernate SessionFactory for HibernateTransactionManager");
+ log.LogInformation("Derived DbProvider [" + sfDbProvider.DbMetadata.ProductName +
+ "] of Hibernate SessionFactory for HibernateTransactionManager");
}
DbProvider = sfDbProvider;
}
else
{
- log.Info("Could not auto detect DbProvider from SessionFactory configuration");
+ log.LogInformation("Could not auto detect DbProvider from SessionFactory configuration");
}
}
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/LocalSessionFactoryObject.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/LocalSessionFactoryObject.cs
index 1bb057a2..30dc8eb2 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/LocalSessionFactoryObject.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/LocalSessionFactoryObject.cs
@@ -490,8 +490,8 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Information))
{
- log.Info("Overriding use of Spring's Hibernate Connection Provider with [" +
- hibernateProperties[Environment.ConnectionProvider] + "]");
+ log.LogInformation("Overriding use of Spring's Hibernate Connection Provider with [" +
+ hibernateProperties[Environment.ConnectionProvider] + "]");
}
config.Properties.Remove(Environment.ConnectionProvider);
@@ -621,7 +621,7 @@ namespace Spring.Data.NHibernate
}
// Build SessionFactory instance.
- log.Info("Building new Hibernate SessionFactory");
+ log.LogInformation("Building new Hibernate SessionFactory");
configuration = config;
sessionFactory = NewSessionFactory(config);
@@ -640,7 +640,7 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Information))
{
- log.Info("Closing Hibernate SessionFactory");
+ log.LogInformation("Closing Hibernate SessionFactory");
}
sessionFactory.Close();
@@ -717,7 +717,7 @@ namespace Spring.Data.NHibernate
///
public void DropDatabaseSchema()
{
- log.Info("Dropping database schema for NHibernate SessionFactory");
+ log.LogInformation("Dropping database schema for NHibernate SessionFactory");
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
hibernateTemplate.Execute(
new HibernateDelegate(session =>
@@ -747,7 +747,7 @@ namespace Spring.Data.NHibernate
///
public void CreateDatabaseSchema()
{
- log.Info("Creating database schema for Hibernate SessionFactory");
+ log.LogInformation("Creating database schema for Hibernate SessionFactory");
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
hibernateTemplate.Execute(
new HibernateDelegate(session =>
@@ -778,7 +778,7 @@ namespace Spring.Data.NHibernate
///
public virtual void UpdateDatabaseSchema()
{
- log.Info("Updating database schema for Hibernate SessionFactory");
+ log.LogInformation("Updating database schema for Hibernate SessionFactory");
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
hibernateTemplate.TemplateFlushMode = TemplateFlushMode.Never;
hibernateTemplate.Execute(
@@ -836,7 +836,7 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Executing schema statement: " + sql);
+ log.LogDebug("Executing schema statement: " + sql);
}
try
{
@@ -847,8 +847,9 @@ namespace Spring.Data.NHibernate
{
if (log.IsEnabled(LogLevel.Warning))
{
- log.Warn("Unsuccessful schema statement: " + sql, ex);
- }
+ string message = "Unsuccessful schema statement: " + sql;
+ log.LogWarning((Exception) ex, message);
+ }
}
}
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SessionFactoryUtils.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SessionFactoryUtils.cs
index 7328b2b1..b7c58aa6 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SessionFactoryUtils.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SessionFactoryUtils.cs
@@ -15,6 +15,7 @@
*/
using System.Collections;
+using Microsoft.Extensions.Logging;
using NHibernate;
using NHibernate.Connection;
using NHibernate.Driver;
@@ -235,7 +236,7 @@ namespace Spring.Data.NHibernate
session = sessionHolder.ValidatedSession;
if (session != null && !sessionHolder.SynchronizedWithTransaction)
{
- log.Debug("Registering Spring transaction synchronization for existing Hibernate Session");
+ log.LogDebug("Registering Spring transaction synchronization for existing Hibernate Session");
TransactionSynchronizationManager.RegisterSynchronization(
new SpringSessionSynchronization(sessionHolder, sessionFactory, adoExceptionTranslator, false));
sessionHolder.SynchronizedWithTransaction = true;
@@ -270,7 +271,7 @@ namespace Spring.Data.NHibernate
// Thread object will get removed by synchronization at transaction completion.
if (TransactionSynchronizationManager.SynchronizationActive)
{
- log.Debug("Registering Spring transaction synchronization for new Hibernate Session");
+ log.LogDebug("Registering Spring transaction synchronization for new Hibernate Session");
SessionHolder holderToUse = sessionHolder;
if (holderToUse == null)
{
@@ -316,7 +317,7 @@ namespace Spring.Data.NHibernate
/// the newly opened session
internal static ISession OpenSession(ISessionFactory sessionFactory, IInterceptor entityInterceptor)
{
- log.Debug("Opening Hibernate Session");
+ log.LogDebug("Opening Hibernate Session");
ISession session = (
(entityInterceptor != null)
? sessionFactory.OpenSession(entityInterceptor)
@@ -335,18 +336,18 @@ namespace Spring.Data.NHibernate
{
if (session != null)
{
- log.Debug("Closing Hibernate Session");
+ log.LogDebug("Closing Hibernate Session");
try
{
session.Close();
}
catch (HibernateException ex)
{
- log.Error("Could not close Hibernate Session", ex);
+ log.LogError(ex, "Could not close Hibernate Session");
}
catch (Exception ex)
{
- log.Error("Unexpected exception on closing Hibernate Session", ex);
+ log.LogError(ex, "Unexpected exception on closing Hibernate Session");
}
}
}
@@ -394,11 +395,14 @@ namespace Spring.Data.NHibernate
"Hibernate operation: " + ex.Message, sqlString, ex.InnerException);
} catch (Exception e)
{
- log.Error("Exception thrown during exception translation. Message = [" + e.Message + "]", e);
- log.Error("Exception that was attempted to be translated was [" + ex.Message + "]", ex);
+ string message = "Exception thrown during exception translation. Message = [" + e.Message + "]";
+ log.LogError(e, message);
+ string message1 = "Exception that was attempted to be translated was [" + ex.Message + "]";
+ log.LogError((Exception) ex, message1);
if (ex.InnerException != null)
{
- log.Error(" Inner Exception was [" + ex.InnerException.Message + "]", ex.InnerException);
+ string message2 = " Inner Exception was [" + ex.InnerException.Message + "]";
+ log.LogError(ex.InnerException, message2);
}
throw new UncategorizedAdoException(e.Message, "", "", e);
}
@@ -501,7 +505,7 @@ namespace Spring.Data.NHibernate
if (holderDictionary != null && sessionFactory != null && holderDictionary.Contains(sessionFactory))
{
- log.Debug("Registering Hibernate Session for deferred close");
+ log.LogDebug("Registering Hibernate Session for deferred close");
// Switch Session to FlushMode.NEVER for remaining lifetime.
session.FlushMode = FlushMode.Never;
Set sessions = (Set) holderDictionary[sessionFactory];
@@ -523,7 +527,7 @@ namespace Spring.Data.NHibernate
{
AssertUtils.ArgumentNotNull(sessionFactory, "No SessionFactory specified");
- log.Debug("Initializing deferred close of Hibernate Sessions");
+ log.LogDebug("Initializing deferred close of Hibernate Sessions");
IDictionary holderDictionary = LogicalThreadContext.GetData(DeferredCloseHolderDataSlotName) as IDictionary;
@@ -569,7 +573,7 @@ namespace Spring.Data.NHibernate
{
throw new InvalidOperationException("Deferred close not active for SessionFactory [" + sessionFactory + "]");
}
- log.Debug("Processing deferred close of Hibernate Sessions");
+ log.LogDebug("Processing deferred close of Hibernate Sessions");
Set sessions = (Set) holderDictionary[sessionFactory];
holderDictionary.Remove(sessionFactory);
foreach (ISession session in sessions)
@@ -687,7 +691,7 @@ namespace Spring.Data.NHibernate
}
else
{
- log.Info("Could not derive IDbProvider from SessionFactory");
+ log.LogInformation("Could not derive IDbProvider from SessionFactory");
}
}
@@ -710,7 +714,7 @@ namespace Spring.Data.NHibernate
{
return new ErrorCodeExceptionTranslator(dbProvider);
}
- log.Warn("Using FallbackException Translator. Could not translate from ISessionFactory to IDbProvider");
+ log.LogWarning("Using FallbackException Translator. Could not translate from ISessionFactory to IDbProvider");
return new FallbackExceptionTranslator();
}
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SessionHolder.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SessionHolder.cs
index bc124396..2c4ff8ec 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SessionHolder.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SessionHolder.cs
@@ -16,6 +16,7 @@
using System.Collections;
using System.Data;
+using Microsoft.Extensions.Logging;
using NHibernate;
using Spring.Transaction.Support;
@@ -295,7 +296,7 @@ namespace Spring.Data.NHibernate
{
if (sessionDictionary.ContainsKey(key))
{
- log.Debug("Overwriting Session in SessionHolder with key = "+ key);
+ log.LogDebug("Overwriting Session in SessionHolder with key = "+ key);
}
sessionDictionary[key] = session;
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SpringSessionSynchronization.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SpringSessionSynchronization.cs
index b1274e4c..d43dd86b 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SpringSessionSynchronization.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/SpringSessionSynchronization.cs
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+using Microsoft.Extensions.Logging;
using NHibernate;
using NHibernate.Engine;
using Spring.Core;
@@ -133,7 +134,7 @@ namespace Spring.Data.NHibernate
if (!readOnly)
{
// read-write transaction -> flush the Hibernate Session
- log.Debug("Flushing Hibernate Session on transaction synchronization");
+ log.LogDebug("Flushing Hibernate Session on transaction synchronization");
ISession session = this.sessionHolder.Session;
//Further check: only flush when not FlushMode.NEVER
if (session.FlushMode != FlushMode.Never)
diff --git a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/Support/SessionScope.cs b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/Support/SessionScope.cs
index b1f0e02e..ac941b6c 100644
--- a/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/Support/SessionScope.cs
+++ b/src/Spring/Spring.Data.NHibernate5/Data/NHibernate/Support/SessionScope.cs
@@ -320,12 +320,12 @@ namespace Spring.Data.NHibernate.Support
if (TransactionSynchronizationManager.HasResource(SessionFactory))
{
// Do not modify the Session: just set the participate flag.
- if (isDebugEnabled) log.Debug("Participating in existing Hibernate SessionFactory");
+ if (isDebugEnabled) log.LogDebug("Participating in existing Hibernate SessionFactory");
SetParticipating(true);
}
else
{
- if (isDebugEnabled) log.Debug("Opening single Hibernate Session in SessionScope");
+ if (isDebugEnabled) log.LogDebug("Opening single Hibernate Session in SessionScope");
TransactionSynchronizationManager.BindResource(SessionFactory, new LazySessionHolder(this));
}
}
@@ -335,12 +335,12 @@ namespace Spring.Data.NHibernate.Support
if (SessionFactoryUtils.IsDeferredCloseActive(SessionFactory))
{
// Do not modify deferred close: just set the participate flag.
- if (isDebugEnabled) log.Debug("Participating in active deferred close mode");
+ if (isDebugEnabled) log.LogDebug("Participating in active deferred close mode");
SetParticipating(true);
}
else
{
- if (isDebugEnabled) log.Debug("Initializing deferred close mode");
+ if (isDebugEnabled) log.LogDebug("Initializing deferred close mode");
SessionFactoryUtils.InitDeferredClose(SessionFactory);
}
}
@@ -355,7 +355,7 @@ namespace Spring.Data.NHibernate.Support
public void Close()
{
bool isDebugEnabled = log.IsEnabled(LogLevel.Debug);
- if (isDebugEnabled) log.Debug("Trying to close SessionScope");
+ if (isDebugEnabled) log.LogDebug("Trying to close SessionScope");
if (IsOpen)
{
@@ -371,7 +371,7 @@ namespace Spring.Data.NHibernate.Support
}
else
{
- if (isDebugEnabled) log.Debug("SessionScope is already closed - doing nothing");
+ if (isDebugEnabled) log.LogDebug("SessionScope is already closed - doing nothing");
}
}
@@ -382,20 +382,20 @@ namespace Spring.Data.NHibernate.Support
if (SingleSession)
{
// single session mode
- if (isLogDebugEnabled) log.Debug("Closing single Hibernate Session in SessionScope");
+ if (isLogDebugEnabled) log.LogDebug("Closing single Hibernate Session in SessionScope");
LazySessionHolder holder = (LazySessionHolder)TransactionSynchronizationManager.UnbindResource(SessionFactory);
holder.Close();
}
else
{
// deferred close mode
- if (isLogDebugEnabled) log.Debug("Closing all Hibernate Sessions");
+ if (isLogDebugEnabled) log.LogDebug("Closing all Hibernate Sessions");
SessionFactoryUtils.ProcessDeferredClose(SessionFactory);
}
}
else
{
- if (isLogDebugEnabled) log.Debug("Only participated Hibernate Session - doing nothing");
+ if (isLogDebugEnabled) log.LogDebug("Only participated Hibernate Session - doing nothing");
}
}
@@ -424,7 +424,7 @@ namespace Spring.Data.NHibernate.Support
///
public LazySessionHolder(SessionScope owner)
{
- if (log.IsEnabled(LogLevel.Debug)) log.Debug("Created LazySessionHolder");
+ if (log.IsEnabled(LogLevel.Debug)) log.LogDebug("Created LazySessionHolder");
this.owner = owner;
}
@@ -435,7 +435,7 @@ namespace Spring.Data.NHibernate.Support
{
if (session == null)
{
- if (log.IsEnabled(LogLevel.Debug)) log.Debug("session instance requested - opening new session");
+ if (log.IsEnabled(LogLevel.Debug)) log.LogDebug("session instance requested - opening new session");
session = owner.DoOpenSession();
AddSession(session);
}
@@ -453,7 +453,7 @@ namespace Spring.Data.NHibernate.Support
session = null;
SessionFactoryUtils.CloseSession(tmpSession);
}
- if (log.IsEnabled(LogLevel.Debug)) log.Debug("Closed LazySessionHolder");
+ if (log.IsEnabled(LogLevel.Debug)) log.LogDebug("Closed LazySessionHolder");
}
}
}
diff --git a/src/Spring/Spring.Data/Data/Common/DbProviderFactory.cs b/src/Spring/Spring.Data/Data/Common/DbProviderFactory.cs
index e1a95ff5..3e71655e 100644
--- a/src/Spring/Spring.Data/Data/Common/DbProviderFactory.cs
+++ b/src/Spring/Spring.Data/Data/Common/DbProviderFactory.cs
@@ -114,7 +114,7 @@ namespace Spring.Data.Common
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Loading additional DbProviders from " + DBPROVIDER_ADDITIONAL_RESOURCE_NAME);
+ log.LogDebug("Loading additional DbProviders from " + DBPROVIDER_ADDITIONAL_RESOURCE_NAME);
}
ctx = new XmlApplicationContext(DBPROVIDER_CONTEXTNAME, true, new string[] { DBPROVIDER_DEFAULT_RESOURCE_NAME,
@@ -128,13 +128,13 @@ namespace Spring.Data.Common
if (log.IsEnabled(LogLevel.Information))
{
var dbProviderNames = ctx.GetObjectNames();
- log.Info(
- $"{dbProviderNames.Count} DbProviders Available. [{StringUtils.CollectionToCommaDelimitedString(dbProviderNames)}]");
+ log.LogInformation($"{dbProviderNames.Count} DbProviders Available. [{StringUtils.CollectionToCommaDelimitedString(dbProviderNames)}]");
}
}
catch (Exception e)
{
- log.Error("Error processing " + DBPROVIDER_DEFAULT_RESOURCE_NAME, e);
+ string message = "Error processing " + DBPROVIDER_DEFAULT_RESOURCE_NAME;
+ log.LogError(e, message);
throw;
}
}
diff --git a/src/Spring/Spring.Data/Data/Common/MultiDelegatingDbProvider.cs b/src/Spring/Spring.Data/Data/Common/MultiDelegatingDbProvider.cs
index c5cf0cb8..59b4a5f4 100644
--- a/src/Spring/Spring.Data/Data/Common/MultiDelegatingDbProvider.cs
+++ b/src/Spring/Spring.Data/Data/Common/MultiDelegatingDbProvider.cs
@@ -278,7 +278,7 @@ namespace Spring.Data.Common
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("No DbProvider defined in thread local storage, falling back to use DefaultDbProvider.");
+ LOG.LogDebug("No DbProvider defined in thread local storage, falling back to use DefaultDbProvider.");
}
return defaultDbProvider;
}
diff --git a/src/Spring/Spring.Data/Data/Core/AdoPlatformTransactionManager.cs b/src/Spring/Spring.Data/Data/Core/AdoPlatformTransactionManager.cs
index 74287ff5..71e598a8 100644
--- a/src/Spring/Spring.Data/Data/Core/AdoPlatformTransactionManager.cs
+++ b/src/Spring/Spring.Data/Data/Core/AdoPlatformTransactionManager.cs
@@ -144,7 +144,7 @@ namespace Spring.Data.Core
IDbConnection newCon = DbProvider.CreateConnection();
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Acquired Connection [" + newCon + ", " + newCon.ConnectionString + "] for ADO.NET transaction");
+ log.LogDebug("Acquired Connection [" + newCon + ", " + newCon.ConnectionString + "] for ADO.NET transaction");
}
newCon.Open();
@@ -261,7 +261,7 @@ namespace Spring.Data.Core
if (status.Debug)
{
IDbConnection conn = txMgrStateObject.ConnectionHolder.Connection;
- log.Debug("Committing ADO.NET transaction on Connection [" + conn + ", " + conn.ConnectionString + "]");
+ log.LogDebug("Committing ADO.NET transaction on Connection [" + conn + ", " + conn.ConnectionString + "]");
}
try
{
@@ -292,7 +292,7 @@ namespace Spring.Data.Core
IDbTransaction trans = txMgrStateObject.ConnectionHolder.Transaction;
if (status.Debug)
{
- log.Debug("Rolling back ADO.NET transaction on Connection [" + conn + ", " + conn.ConnectionString + "]" );
+ log.LogDebug("Rolling back ADO.NET transaction on Connection [" + conn + ", " + conn.ConnectionString + "]");
}
try
{
@@ -319,7 +319,7 @@ namespace Spring.Data.Core
if (status.Debug)
{
IDbConnection conn = txMgrStateObject.ConnectionHolder.Connection;
- log.Debug("Setting ADO.NET transaction [" + conn + ", " + conn.ConnectionString + "] rollback-only.");
+ log.LogDebug("Setting ADO.NET transaction [" + conn + ", " + conn.ConnectionString + "] rollback-only.");
}
txMgrStateObject.SetRollbackOnly();
@@ -337,7 +337,7 @@ namespace Spring.Data.Core
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Releasing ADO.NET Connection [" + con + ", " + con.ConnectionString + "] after transaction");
+ log.LogDebug("Releasing ADO.NET Connection [" + con + ", " + con.ConnectionString + "] after transaction");
}
ConnectionUtils.DisposeConnection(con, DbProvider);
diff --git a/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs b/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs
index 9d1d6061..3978d59a 100644
--- a/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs
+++ b/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs
@@ -168,7 +168,7 @@ namespace Spring.Data.Core
}
else
{
- LOG.Warn("Ignoring assignment of DataReaderWrapperType since it has already been assigned.");
+ LOG.LogWarning("Ignoring assignment of DataReaderWrapperType since it has already been assigned.");
}
}
@@ -368,7 +368,7 @@ namespace Spring.Data.Core
#region Instrumentation
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing NonQuery " + cmdType + "[" + cmdText + "]");
+ LOG.LogDebug("Executing NonQuery " + cmdType + "[" + cmdText + "]");
}
#endregion
@@ -407,7 +407,7 @@ namespace Spring.Data.Core
#region Instrumentation
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing NonQuery. " + cmdType + "[" + cmdText + "]");
+ LOG.LogDebug("Executing NonQuery. " + cmdType + "[" + cmdText + "]");
}
#endregion
@@ -429,7 +429,7 @@ namespace Spring.Data.Core
#region Instrumentation
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing NonQuery. " + cmdType + "[" + cmdText + "]");
+ LOG.LogDebug("Executing NonQuery. " + cmdType + "[" + cmdText + "]");
}
#endregion
@@ -522,7 +522,7 @@ namespace Spring.Data.Core
#region Instrumentation
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing ExecuteScalar. " + cmdType + "[" + cmdText + "]");
+ LOG.LogDebug("Executing ExecuteScalar. " + cmdType + "[" + cmdText + "]");
}
#endregion
@@ -722,7 +722,7 @@ namespace Spring.Data.Core
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing SQL [" + sql + "]");
+ LOG.LogDebug("Executing SQL [" + sql + "]");
}
return Execute(new QueryCallback(this, cmdType, sql, rse, null));
@@ -773,7 +773,7 @@ namespace Spring.Data.Core
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing SQL [" + sql + "]");
+ LOG.LogDebug("Executing SQL [" + sql + "]");
}
return Execute(new QueryCallback(this, cmdType, sql, resultSetExtractorDelegate, null));
@@ -1139,7 +1139,7 @@ namespace Spring.Data.Core
#region Instrumentation
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing DataTableFill " + commandType + "[" + sql + "]");
+ LOG.LogDebug("Executing DataTableFill " + commandType + "[" + sql + "]");
}
#endregion
@@ -1157,7 +1157,7 @@ namespace Spring.Data.Core
#region Instrumentation
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing DataTableFill " + commandType + "[" + sql + "] with table mapping name " + tableMappingName);
+ LOG.LogDebug("Executing DataTableFill " + commandType + "[" + sql + "] with table mapping name " + tableMappingName);
}
#endregion
@@ -1478,7 +1478,7 @@ namespace Spring.Data.Core
#region Instrumentation
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing DataSetFill " + commandType + "[" + sql + "]");
+ LOG.LogDebug("Executing DataSetFill " + commandType + "[" + sql + "]");
}
#endregion
@@ -1498,7 +1498,7 @@ namespace Spring.Data.Core
#region Instrumentation
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing DataSetFill " + commandType + "[" + sql + "] with table names " + tableNames);
+ LOG.LogDebug("Executing DataSetFill " + commandType + "[" + sql + "] with table names " + tableNames);
}
#endregion
@@ -2538,21 +2538,23 @@ namespace Spring.Data.Core
//Will only have possibility of run-time type error if using QueryWithCommandCreator
if (namedResultSetProcessor == null)
{
- LOG.Error("NamedResultSetProcessor for result set index " + resultSetIndex +
- ", is not of expected type NamedResultSetProcessor. Type = " +
- namedResultSetProcessors[resultSetIndex].GetType() +
- "; Skipping processing for this result set.");
+ LOG.LogError("NamedResultSetProcessor for result set index " + resultSetIndex +
+ ", is not of expected type NamedResultSetProcessor. Type = " +
+ namedResultSetProcessors[resultSetIndex].GetType() +
+ "; Skipping processing for this result set.");
continue;
}
}
catch (IndexOutOfRangeException e)
{
- LOG.Error("No NamedResultSetProcessor associated with result set index " + resultSetIndex, e);
+ string message = "No NamedResultSetProcessor associated with result set index " + resultSetIndex;
+ LOG.LogError(e, message);
continue;
}
catch (ArgumentOutOfRangeException e)
{
- LOG.Error("No NamedResultSetProcessor associated with result set index " + resultSetIndex, e);
+ string message = "No NamedResultSetProcessor associated with result set index " + resultSetIndex;
+ LOG.LogError(e, message);
continue;
}
@@ -2793,7 +2795,7 @@ namespace Spring.Data.Core
Object rowsAffected = command.ExecuteNonQuery();
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("ExecuteNonQuery affected " + rowsAffected + " rows");
+ LOG.LogDebug("ExecuteNonQuery affected " + rowsAffected + " rows");
}
return rowsAffected;
}
@@ -2859,7 +2861,7 @@ namespace Spring.Data.Core
Object returnValue = command.ExecuteScalar();
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("ExecuteScalar return value = " + returnValue);
+ LOG.LogDebug("ExecuteScalar return value = " + returnValue);
}
return returnValue;
}
diff --git a/src/Spring/Spring.Data/Data/Core/ServiceDomainPlatformTransactionManager.cs b/src/Spring/Spring.Data/Data/Core/ServiceDomainPlatformTransactionManager.cs
index 417737b3..b25b9ddd 100644
--- a/src/Spring/Spring.Data/Data/Core/ServiceDomainPlatformTransactionManager.cs
+++ b/src/Spring/Spring.Data/Data/Core/ServiceDomainPlatformTransactionManager.cs
@@ -150,8 +150,8 @@ namespace Spring.Data.Core
serviceDomainTxObject.ServiceDomainAdapter.Enter(serviceConfig);
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Context created. TransactionId = " + ContextUtil.TransactionId
- + ", ActivityId = " + ContextUtil.ActivityId);
+ log.LogDebug("Context created. TransactionId = " + ContextUtil.TransactionId
+ + ", ActivityId = " + ContextUtil.ActivityId);
}
}
@@ -199,7 +199,7 @@ namespace Spring.Data.Core
case System.Data.IsolationLevel.Chaos:
if (log.IsEnabled(LogLevel.Information))
{
- log.Info("IsolationLevel Chaos does not have a direct counterpart in EnterpriseServices, using Any");
+ log.LogInformation("IsolationLevel Chaos does not have a direct counterpart in EnterpriseServices, using Any");
}
serviceConfig.IsolationLevel = TransactionIsolationLevel.Any;
break;
@@ -218,7 +218,7 @@ namespace Spring.Data.Core
case System.Data.IsolationLevel.Snapshot:
if (log.IsEnabled(LogLevel.Information))
{
- log.Info("IsolationLevel Snapshot does not have a direct counterpart in EnterpriseServices, using ReadCommitted. Introduced in SqlServer 2005. Consider using System.Transactions for transaction management instead.");
+ log.LogInformation("IsolationLevel Snapshot does not have a direct counterpart in EnterpriseServices, using ReadCommitted. Introduced in SqlServer 2005. Consider using System.Transactions for transaction management instead.");
}
serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadCommitted; //err on the side of consistency
break;
@@ -254,9 +254,9 @@ namespace Spring.Data.Core
} else
{
//TODO Should we throw an exception instead?
- log.Warn("The requested transaction propagation option " +
- definition.PropagationBehavior + " is not supported. " +
- "Defaulting to Never(Disabled) ");
+ log.LogWarning("The requested transaction propagation option " +
+ definition.PropagationBehavior + " is not supported. " +
+ "Defaulting to Never(Disabled) ");
}
}
@@ -284,7 +284,7 @@ namespace Spring.Data.Core
TransactionStatus serviceDomainTxstatus = txObject.ServiceDomainAdapter.Leave();
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("ServiceDomain Transaction Status upon leaving ServiceDomain = " + serviceDomainTxstatus);
+ log.LogDebug("ServiceDomain Transaction Status upon leaving ServiceDomain = " + serviceDomainTxstatus);
}
txObject.TransactionStatus = serviceDomainTxstatus;
if (!globalRollbackOnly && serviceDomainTxstatus == TransactionStatus.Aborted)
@@ -329,7 +329,7 @@ namespace Spring.Data.Core
ServiceDomainTransactionObject txObject = (ServiceDomainTransactionObject)status.Transaction;
if (status.Debug)
{
- log.Debug("Setting transaction rollback-only");
+ log.LogDebug("Setting transaction rollback-only");
}
try
{
diff --git a/src/Spring/Spring.Data/Data/Core/TxScopeTransactionManager.cs b/src/Spring/Spring.Data/Data/Core/TxScopeTransactionManager.cs
index 9553cdab..7ad8b35e 100644
--- a/src/Spring/Spring.Data/Data/Core/TxScopeTransactionManager.cs
+++ b/src/Spring/Spring.Data/Data/Core/TxScopeTransactionManager.cs
@@ -15,6 +15,7 @@
*/
using System.Transactions;
+using Microsoft.Extensions.Logging;
using Spring.Data.Support;
using Spring.Objects.Factory;
using Spring.Transaction;
@@ -146,7 +147,7 @@ namespace Spring.Data.Core
{
if (status.Debug)
{
- log.Debug("Setting transaction rollback-only");
+ log.LogDebug("Setting transaction rollback-only");
}
try
diff --git a/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs b/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs
index 22b66574..56e92b55 100644
--- a/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs
+++ b/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs
@@ -873,7 +873,7 @@ namespace Spring.Data.Generic
AssertUtils.ArgumentNotNull(cmdText, "cmdText", "CommandText must not be null");
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing CommandText [" + cmdText + "]");
+ LOG.LogDebug("Executing CommandText [" + cmdText + "]");
}
return Execute(new QueryCallback(this, cmdType, cmdText, resultSetExtractor, null));
}
@@ -927,7 +927,7 @@ namespace Spring.Data.Generic
AssertUtils.ArgumentNotNull(resultSetExtractorDelegate, "resultSetExtractorDelegate", "Result set extractor delegate must not be null");
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing CommandText [" + cmdText + "]");
+ LOG.LogDebug("Executing CommandText [" + cmdText + "]");
}
return Execute(new QueryCallback(this, cmdType, cmdText, resultSetExtractorDelegate, null));
@@ -1501,10 +1501,10 @@ namespace Spring.Data.Generic
//Will have possibility of run-time type error if using QueryWithCommandCreator
if (firstResultSetProcessor == null)
{
- LOG.Error("NamedResultSetProcessor for result set index " + resultSetIndex +
- ", is not of expected type NamedResultSetProcessor. Type = " +
- namedResultSetProcessors[resultSetIndex].GetType() +
- "; Skipping processing for this result set.");
+ LOG.LogError("NamedResultSetProcessor for result set index " + resultSetIndex +
+ ", is not of expected type NamedResultSetProcessor. Type = " +
+ namedResultSetProcessors[resultSetIndex].GetType() +
+ "; Skipping processing for this result set.");
continue;
}
}
@@ -1515,22 +1515,24 @@ namespace Spring.Data.Generic
if (otherResultSetProcessor == null)
{
- LOG.Error("NamedResultSetProcessor for result set index " + resultSetIndex +
- ", is not of expected type NamedResultSetProcessor Type = " +
- namedResultSetProcessors[resultSetIndex].GetType() +
- "; Skipping processing for this result set.");
+ LOG.LogError("NamedResultSetProcessor for result set index " + resultSetIndex +
+ ", is not of expected type NamedResultSetProcessor Type = " +
+ namedResultSetProcessors[resultSetIndex].GetType() +
+ "; Skipping processing for this result set.");
continue;
}
}
}
catch (IndexOutOfRangeException e)
{
- LOG.Error("No NamedResultSetProcessor associated with result set index " + resultSetIndex, e);
+ string message = "No NamedResultSetProcessor associated with result set index " + resultSetIndex;
+ LOG.LogError(e, message);
continue;
}
catch (ArgumentOutOfRangeException e)
{
- LOG.Error("No NamedResultSetProcessor associated with result set index " + resultSetIndex, e);
+ string message = "No NamedResultSetProcessor associated with result set index " + resultSetIndex;
+ LOG.LogError(e, message);
continue;
}
@@ -1601,10 +1603,10 @@ namespace Spring.Data.Generic
if (firstResultSetProcessor == null)
{
- LOG.Error("NamedResultSetProcessor for result set index " + resultSetIndex +
- ", is not of expected type NamedResultSetProcessor Type = " +
- namedResultSetProcessors[resultSetIndex].GetType() +
- "; Skipping processing for this result set.");
+ LOG.LogError("NamedResultSetProcessor for result set index " + resultSetIndex +
+ ", is not of expected type NamedResultSetProcessor Type = " +
+ namedResultSetProcessors[resultSetIndex].GetType() +
+ "; Skipping processing for this result set.");
continue;
}
} else if (resultSetIndex == 1)
@@ -1614,10 +1616,10 @@ namespace Spring.Data.Generic
if (secondResultSetProcessor == null)
{
- LOG.Error("NamedResultSetProcessor for result set index " + resultSetIndex +
- ", is not of expected type NamedResultSetProcessor Type = " +
- namedResultSetProcessors[resultSetIndex].GetType() +
- "; Skipping processing for this result set.");
+ LOG.LogError("NamedResultSetProcessor for result set index " + resultSetIndex +
+ ", is not of expected type NamedResultSetProcessor Type = " +
+ namedResultSetProcessors[resultSetIndex].GetType() +
+ "; Skipping processing for this result set.");
continue;
}
} else
@@ -1627,10 +1629,10 @@ namespace Spring.Data.Generic
if (otherResultSetProcessor == null)
{
- LOG.Error("NamedResultSetProcessor for result set index " + resultSetIndex +
- ", is not of expected type NamedResultSetProcessor Type = " +
- namedResultSetProcessors[resultSetIndex].GetType() +
- "; Skipping processing for this result set.");
+ LOG.LogError("NamedResultSetProcessor for result set index " + resultSetIndex +
+ ", is not of expected type NamedResultSetProcessor Type = " +
+ namedResultSetProcessors[resultSetIndex].GetType() +
+ "; Skipping processing for this result set.");
continue;
}
}
@@ -1638,12 +1640,14 @@ namespace Spring.Data.Generic
}
catch (IndexOutOfRangeException e)
{
- LOG.Error("No NamedResultSetProcessor associated with result set index " + resultSetIndex, e);
+ string message = "No NamedResultSetProcessor associated with result set index " + resultSetIndex;
+ LOG.LogError(e, message);
continue;
}
catch (ArgumentOutOfRangeException e)
{
- LOG.Error("No NamedResultSetProcessor associated with result set index " + resultSetIndex, e);
+ string message = "No NamedResultSetProcessor associated with result set index " + resultSetIndex;
+ LOG.LogError(e, message);
continue;
}
diff --git a/src/Spring/Spring.Data/Data/Objects/AbstractAdoOperation.cs b/src/Spring/Spring.Data/Data/Objects/AbstractAdoOperation.cs
index 78ddb664..407eeeac 100644
--- a/src/Spring/Spring.Data/Data/Objects/AbstractAdoOperation.cs
+++ b/src/Spring/Spring.Data/Data/Objects/AbstractAdoOperation.cs
@@ -20,6 +20,7 @@
using System.Collections;
using System.Data;
+using Microsoft.Extensions.Logging;
using Spring.Dao;
using Spring.Data.Common;
using Spring.Objects.Factory;
@@ -178,7 +179,7 @@ namespace Spring.Data.Objects
{
if (!Compiled)
{
- log.Debug("ADO operation not compiled before execution - invoking compile");
+ log.LogDebug("ADO operation not compiled before execution - invoking compile");
Compile();
}
}
diff --git a/src/Spring/Spring.Data/Data/Support/AdoUtils.cs b/src/Spring/Spring.Data/Data/Support/AdoUtils.cs
index 632ba3ed..c5aa9074 100644
--- a/src/Spring/Spring.Data/Data/Support/AdoUtils.cs
+++ b/src/Spring/Spring.Data/Data/Support/AdoUtils.cs
@@ -1,4 +1,5 @@
using System.Data;
+using Microsoft.Extensions.Logging;
namespace Spring.Data.Support
{
@@ -65,7 +66,7 @@ namespace Spring.Data.Support
}
catch (Exception e)
{
- LOG.Warn("Could not close IDataRader", e);
+ LOG.LogWarning(e, "Could not close IDataRader");
}
}
}
@@ -78,7 +79,7 @@ namespace Spring.Data.Support
}
catch (Exception e)
{
- LOG.Warn("Could not dispose of command", e);
+ LOG.LogWarning(e, "Could not dispose of command");
}
}
diff --git a/src/Spring/Spring.Data/Data/Support/ConnectionUtils.cs b/src/Spring/Spring.Data/Data/Support/ConnectionUtils.cs
index f553a512..6912bcdc 100644
--- a/src/Spring/Spring.Data/Data/Support/ConnectionUtils.cs
+++ b/src/Spring/Spring.Data/Data/Support/ConnectionUtils.cs
@@ -53,7 +53,7 @@ namespace Spring.Data.Support
}
catch (Exception e)
{
- LOG.Warn("Could not close connection", e);
+ LOG.LogWarning(e, "Could not close connection");
}
}
@@ -76,7 +76,7 @@ namespace Spring.Data.Support
}
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Disposing of IDbConnection with connection string = [" + dbProvider.ConnectionString + "]");
+ LOG.LogDebug("Disposing of IDbConnection with connection string = [" + dbProvider.ConnectionString + "]");
}
conn.Dispose();
}
@@ -132,7 +132,7 @@ namespace Spring.Data.Support
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Fetching resumed ADO.NET connection from DbProvider");
+ LOG.LogDebug("Fetching resumed ADO.NET connection from DbProvider");
}
conHolder.Connection = provider.CreateConnection();
}
@@ -142,14 +142,14 @@ namespace Spring.Data.Support
// Else we either got no holder or an empty thread-bound holder here.
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Fetching Connection from DbProvider");
+ LOG.LogDebug("Fetching Connection from DbProvider");
}
IDbConnection conn = provider.CreateConnection();
conn.Open();
if (TransactionSynchronizationManager.SynchronizationActive)
{
- LOG.Debug("Registering transaction synchronization for IDbConnection");
+ LOG.LogDebug("Registering transaction synchronization for IDbConnection");
//Use same connection for further ADO.NET actions with the transaction.
//Thread-bound object will get removed by manager at transaction completion.
diff --git a/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs b/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs
index 7b68cebc..36f850a2 100644
--- a/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs
+++ b/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs
@@ -169,7 +169,7 @@ namespace Spring.Data.Support
// Looking for a fallback...
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Unable to translate exception with errorCode '" + errorCode + "', will use the fallback translator");
+ log.LogDebug("Unable to translate exception with errorCode '" + errorCode + "', will use the fallback translator");
}
IAdoExceptionTranslator fallback = FallbackTranslator;
if (fallback != null)
@@ -327,9 +327,9 @@ namespace Spring.Data.Support
if (log.IsEnabled(LogLevel.Debug))
{
String intro = "Translating";
- log.Debug(intro + " ADO exception with error code '" + errorCode
- + "', message [" + exception.Message +
- "]; SQL was [" + sql + "] for task [" + task + "]");
+ log.LogDebug(intro + " ADO exception with error code '" + errorCode
+ + "', message [" + exception.Message +
+ "]; SQL was [" + sql + "] for task [" + task + "]");
}
}
diff --git a/src/Spring/Spring.Data/Data/Support/TypedDataSetUtils.cs b/src/Spring/Spring.Data/Data/Support/TypedDataSetUtils.cs
index 32860222..a9a5082d 100644
--- a/src/Spring/Spring.Data/Data/Support/TypedDataSetUtils.cs
+++ b/src/Spring/Spring.Data/Data/Support/TypedDataSetUtils.cs
@@ -20,6 +20,7 @@
using System.Data;
using System.Reflection;
+using Microsoft.Extensions.Logging;
using Spring.Data.Common;
namespace Spring.Data.Support
@@ -130,7 +131,7 @@ namespace Spring.Data.Support
}
else
{
- LOG.Warn("Could not extract IDbDataAdapter from TypedDataset.");
+ LOG.LogWarning("Could not extract IDbDataAdapter from TypedDataset.");
}
@@ -146,7 +147,7 @@ namespace Spring.Data.Support
}
else
{
- LOG.Warn("Could not extract IDbCommand collection from TypedDataset.");
+ LOG.LogWarning("Could not extract IDbCommand collection from TypedDataset.");
}
}
diff --git a/src/Spring/Spring.Data/Transaction/Interceptor/MethodMapTransactionAttributeSource.cs b/src/Spring/Spring.Data/Transaction/Interceptor/MethodMapTransactionAttributeSource.cs
index bd7b8791..c24b6847 100644
--- a/src/Spring/Spring.Data/Transaction/Interceptor/MethodMapTransactionAttributeSource.cs
+++ b/src/Spring/Spring.Data/Transaction/Interceptor/MethodMapTransactionAttributeSource.cs
@@ -174,8 +174,8 @@ namespace Spring.Transaction.Interceptor
// method name specification now -> (re-)register method.
if (LOG.IsEnabled(LogLevel.Debug) && regularMethodName != null)
{
- LOG.Debug("Replacing attribute for transactional method [" + currentMethod + "]: current name '" +
- name + "' is more specific than '" + regularMethodName + "'");
+ LOG.LogDebug("Replacing attribute for transactional method [" + currentMethod + "]: current name '" +
+ name + "' is more specific than '" + regularMethodName + "'");
}
_nameMap.Add( currentMethod, name );
AddTransactionalMethod( currentMethod, transactionAttribute );
@@ -184,8 +184,8 @@ namespace Spring.Transaction.Interceptor
{
if (LOG.IsEnabled(LogLevel.Debug) && regularMethodName != null)
{
- LOG.Debug("Keeping attribute for transactional method [" + currentMethod + "]: current name '" +
- name + "' is not more specific than '" + regularMethodName + "'");
+ LOG.LogDebug("Keeping attribute for transactional method [" + currentMethod + "]: current name '" +
+ name + "' is not more specific than '" + regularMethodName + "'");
}
}
}
diff --git a/src/Spring/Spring.Data/Transaction/Interceptor/NameMatchTransactionAttributeSource.cs b/src/Spring/Spring.Data/Transaction/Interceptor/NameMatchTransactionAttributeSource.cs
index 8f386ab9..169075cd 100644
--- a/src/Spring/Spring.Data/Transaction/Interceptor/NameMatchTransactionAttributeSource.cs
+++ b/src/Spring/Spring.Data/Transaction/Interceptor/NameMatchTransactionAttributeSource.cs
@@ -160,7 +160,7 @@ namespace Spring.Transaction.Interceptor
#region Instrumentation
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Adding transactional method [" + methodName + "] with attribute [" + attribute + "]");
+ log.LogDebug("Adding transactional method [" + methodName + "] with attribute [" + attribute + "]");
}
#endregion
nameMap.Add( methodName, attribute );
diff --git a/src/Spring/Spring.Data/Transaction/Interceptor/TransactionAspectSupport.cs b/src/Spring/Spring.Data/Transaction/Interceptor/TransactionAspectSupport.cs
index b75e0491..4e0a91b4 100644
--- a/src/Spring/Spring.Data/Transaction/Interceptor/TransactionAspectSupport.cs
+++ b/src/Spring/Spring.Data/Transaction/Interceptor/TransactionAspectSupport.cs
@@ -350,7 +350,7 @@ namespace Spring.Transaction.Interceptor
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Getting transaction for " + transactionInfo.JoinpointIdentification);
+ log.LogDebug("Getting transaction for " + transactionInfo.JoinpointIdentification);
}
#endregion
@@ -364,8 +364,8 @@ namespace Spring.Transaction.Interceptor
// the ThreadLocal stack maintained in this class.
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Skipping transactional joinpoint [" + joinpointIdentification +
- "] because no transaction manager has been configured");
+ log.LogDebug("Skipping transactional joinpoint [" + joinpointIdentification +
+ "] because no transaction manager has been configured");
}
}
@@ -407,7 +407,7 @@ namespace Spring.Transaction.Interceptor
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Completing transaction for [" + transactionInfo.JoinpointIdentification + "]");
+ log.LogDebug("Completing transaction for [" + transactionInfo.JoinpointIdentification + "]");
}
#endregion
@@ -437,7 +437,7 @@ namespace Spring.Transaction.Interceptor
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Completing transaction for [" + transactionInfo.JoinpointIdentification + "] after exception: " + exception);
+ log.LogDebug("Completing transaction for [" + transactionInfo.JoinpointIdentification + "] after exception: " + exception);
}
if ( transactionInfo.TransactionAttribute.RollbackOn( exception ))
@@ -448,7 +448,7 @@ namespace Spring.Transaction.Interceptor
}
catch (Exception e)
{
- log.Error("Application exception overridden by rollback exception", e);
+ log.LogError(e, "Application exception overridden by rollback exception");
throw;
}
}
@@ -461,7 +461,7 @@ namespace Spring.Transaction.Interceptor
_transactionManager.Commit(transactionInfo.TransactionStatus);
} catch (Exception e)
{
- log.Error("Application exception overriden by commit exception", e);
+ log.LogError(e, "Application exception overriden by commit exception");
throw;
}
diff --git a/src/Spring/Spring.Data/Transaction/Support/AbstractPlatformTransactionManager.cs b/src/Spring/Spring.Data/Transaction/Support/AbstractPlatformTransactionManager.cs
index 0ff185de..3ed86a85 100644
--- a/src/Spring/Spring.Data/Transaction/Support/AbstractPlatformTransactionManager.cs
+++ b/src/Spring/Spring.Data/Transaction/Support/AbstractPlatformTransactionManager.cs
@@ -443,8 +443,8 @@ namespace Spring.Transaction.Support
protected virtual void RegisterAfterCompletionWithExistingTransaction(Object transaction, IList synchronizations)
{
- log.Debug("Cannot register Spring after-completion synchronization with existing transaction - " +
- "processing Spring after-completion callbacks immediately, with outcome status 'unknown'");
+ log.LogDebug("Cannot register Spring after-completion synchronization with existing transaction - " +
+ "processing Spring after-completion callbacks immediately, with outcome status 'unknown'");
InvokeAfterCompletion(synchronizations, TransactionSynchronizationStatus.Unknown);
}
@@ -516,7 +516,7 @@ namespace Spring.Transaction.Support
if (debugEnabled)
{
- log.Debug("Using transaction object [" + transaction + "]");
+ log.LogDebug("Using transaction object [" + transaction + "]");
}
if (definition == null)
@@ -548,7 +548,7 @@ namespace Spring.Transaction.Support
object suspendedResources = Suspend(null);
if (debugEnabled)
{
- log.Debug("Creating new transaction with name [" + definition.Name + "]:" + definition);
+ log.LogDebug("Creating new transaction with name [" + definition.Name + "]:" + definition);
}
try
{
@@ -610,7 +610,7 @@ namespace Spring.Transaction.Support
{
if (debugEnabled)
{
- log.Debug("Suspending current transaction");
+ log.LogDebug("Suspending current transaction");
}
object suspendedResources = Suspend(transaction);
bool newSynchronization = (_transactionSyncState == TransactionSynchronizationState.Always);
@@ -623,8 +623,8 @@ namespace Spring.Transaction.Support
{
if (debugEnabled)
{
- log.Debug("Suspending current transaction, creating new transaction with name [" +
- definition.Name + "]:" + definition);
+ log.LogDebug("Suspending current transaction, creating new transaction with name [" +
+ definition.Name + "]:" + definition);
}
object suspendedResources = Suspend(transaction);
try
@@ -646,10 +646,9 @@ namespace Spring.Transaction.Support
}
catch (TransactionException resumeEx)
{
- log.Error(
- "Inner transaction begin exception overridden by outer transaction resume exception");
- log.Error("Begin Transaction Exception", beginEx);
- log.Error("Resume Transaction Exception", resumeEx);
+ log.LogError("Inner transaction begin exception overridden by outer transaction resume exception");
+ log.LogError(beginEx, "Begin Transaction Exception");
+ log.LogError(resumeEx, "Resume Transaction Exception");
throw;
}
throw;
@@ -665,7 +664,7 @@ namespace Spring.Transaction.Support
}
if (debugEnabled)
{
- log.Debug("Creating nested transaction with name [" + definition.Name + "]:" + definition);
+ log.LogDebug("Creating nested transaction with name [" + definition.Name + "]:" + definition);
}
if (UseSavepointForNestedTransaction())
@@ -688,7 +687,7 @@ namespace Spring.Transaction.Support
// Assumably PROPAGATION_SUPPORTS.
if (debugEnabled)
{
- log.Debug("Participating in existing transaction");
+ log.LogDebug("Participating in existing transaction");
}
//TODO: this block related to un-ported java feature permitting setting the ValidateExistingTransaction flag
@@ -749,7 +748,7 @@ namespace Spring.Transaction.Support
{
if (defaultStatus.Debug)
{
- log.Debug("Transaction code has requested rollback");
+ log.LogDebug("Transaction code has requested rollback");
}
ProcessRollback(defaultStatus);
return;
@@ -758,7 +757,7 @@ namespace Spring.Transaction.Support
{
if (defaultStatus.Debug)
{
- log.Debug("Global transaction is marked as rollback-only but transactional code requested commit");
+ log.LogDebug("Global transaction is marked as rollback-only but transactional code requested commit");
}
ProcessRollback(defaultStatus);
// Throw UnexpectedRollbackException only at outermost transaction boundary
@@ -859,7 +858,7 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Trigger AfterCommit Synchronization");
+ log.LogDebug("Trigger AfterCommit Synchronization");
}
IList synchronizations = TransactionSynchronizationManager.Synchronizations;
foreach (ITransactionSynchronization currentTxnSynchronization in synchronizations)
@@ -870,7 +869,7 @@ namespace Spring.Transaction.Support
}
catch (Exception e)
{
- log.Error("TransactionSynchronization.AfterCommit thew exception", e);
+ log.LogError(e, "TransactionSynchronization.AfterCommit thew exception");
}
}
}
@@ -923,7 +922,7 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Rolling back transaction to savepoint.");
+ log.LogDebug("Rolling back transaction to savepoint.");
}
status.RollbackToHeldSavepoint();
}
@@ -931,7 +930,7 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Initiating transaction rollback");
+ log.LogDebug("Initiating transaction rollback");
}
DoRollback(status);
}
@@ -941,14 +940,14 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Participating transaction failed - marking existing transaction as rollback-only");
+ log.LogDebug("Participating transaction failed - marking existing transaction as rollback-only");
}
}
DoSetRollbackOnly(status);
}
else
{
- log.Debug("Should roll back transaction but cannot - no transaction available.");
+ log.LogDebug("Should roll back transaction but cannot - no transaction available.");
}
}
catch (Exception)
@@ -1135,7 +1134,7 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Initiating transaction rollback on commit exception.");
+ log.LogDebug("Initiating transaction rollback on commit exception.");
}
DoRollback(status);
}
@@ -1143,7 +1142,7 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Marking existing transaction as rollback-only after commit exception", exception);
+ log.LogDebug(exception, "Marking existing transaction as rollback-only after commit exception");
}
DoSetRollbackOnly(status);
}
@@ -1151,7 +1150,7 @@ namespace Spring.Transaction.Support
catch (Exception)
{
//TODO investigate rollback behavior...
- log.Error("Commit exception overridden by rollback exception", exception);
+ log.LogError(exception, "Commit exception overridden by rollback exception");
TriggerAfterCompletion(status, TransactionSynchronizationStatus.Unknown);
throw;
}
@@ -1184,7 +1183,7 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Trigger BeforeCompletion Synchronization");
+ log.LogDebug("Trigger BeforeCompletion Synchronization");
}
IList synchronizations = TransactionSynchronizationManager.Synchronizations;
foreach (ITransactionSynchronization synchronization in synchronizations)
@@ -1195,7 +1194,7 @@ namespace Spring.Transaction.Support
}
catch (Exception e)
{
- log.Error("TransactionSynchronization.BeforeCompletion threw exception", e);
+ log.LogError(e, "TransactionSynchronization.BeforeCompletion threw exception");
}
}
}
@@ -1217,14 +1216,14 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Triggering afterCompletion synchronization");
+ log.LogDebug("Triggering afterCompletion synchronization");
}
InvokeAfterCompletion(synchronizations, completionStatus);
}
else
{
//TODO investigate parallel of JTA/System.Txs
- log.Info("Transaction controlled outside of spring tx manager.");
+ log.LogInformation("Transaction controlled outside of spring tx manager.");
RegisterAfterCompletionWithExistingTransaction(status.Transaction, synchronizations);
}
}
@@ -1240,7 +1239,7 @@ namespace Spring.Transaction.Support
}
catch (Exception e)
{
- log.Error("TransactionSynchronization.AfterCompletion threw exception", e);
+ log.LogError(e, "TransactionSynchronization.AfterCompletion threw exception");
}
}
}
@@ -1265,7 +1264,7 @@ namespace Spring.Transaction.Support
{
if (status.Debug)
{
- log.Debug("Resuming suspended transaction");
+ log.LogDebug("Resuming suspended transaction");
}
Resume(status.Transaction, status.SuspendedResources);
}
diff --git a/src/Spring/Spring.Data/Transaction/Support/TransactionSynchronizationManager.cs b/src/Spring/Spring.Data/Transaction/Support/TransactionSynchronizationManager.cs
index 80a40163..4e667e93 100644
--- a/src/Spring/Spring.Data/Transaction/Support/TransactionSynchronizationManager.cs
+++ b/src/Spring/Spring.Data/Transaction/Support/TransactionSynchronizationManager.cs
@@ -147,8 +147,8 @@ namespace Spring.Transaction.Support
if (val != null && LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Retrieved value [" + Describe(val) + "] for key [" + Describe(key) + "] bound to thread [" +
- SystemUtils.ThreadId + "]");
+ LOG.LogDebug("Retrieved value [" + Describe(val) + "] for key [" + Describe(key) + "] bound to thread [" +
+ SystemUtils.ThreadId + "]");
}
return val;
}
@@ -178,8 +178,8 @@ namespace Spring.Transaction.Support
resources.Add(key, value);
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Bound value [" + Describe(value) + "] for key [" + Describe(key) + "] to thread [" +
- SystemUtils.ThreadId + "]");
+ LOG.LogDebug("Bound value [" + Describe(value) + "] for key [" + Describe(key) + "] to thread [" +
+ SystemUtils.ThreadId + "]");
}
}
@@ -208,8 +208,8 @@ namespace Spring.Transaction.Support
}
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Removed value [" + Describe(val) + "] for key [" + Describe(key) + "] from thread [" +
- SystemUtils.ThreadId + "]");
+ LOG.LogDebug("Removed value [" + Describe(val) + "] for key [" + Describe(key) + "] from thread [" +
+ SystemUtils.ThreadId + "]");
}
return val;
}
@@ -233,7 +233,7 @@ namespace Spring.Transaction.Support
}
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Initializing transaction synchronization");
+ LOG.LogDebug("Initializing transaction synchronization");
}
ArrayList syncs = new ArrayList();
LogicalThreadContext.SetData(syncsDataSlotName, syncs);
@@ -256,7 +256,7 @@ namespace Spring.Transaction.Support
}
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Clearing transaction synchronization");
+ LOG.LogDebug("Clearing transaction synchronization");
}
LogicalThreadContext.FreeNamedDataSlot(syncsDataSlotName);
}
diff --git a/src/Spring/Spring.Data/Transaction/Support/TransactionTemplate.cs b/src/Spring/Spring.Data/Transaction/Support/TransactionTemplate.cs
index 5aa7db11..5579f18f 100644
--- a/src/Spring/Spring.Data/Transaction/Support/TransactionTemplate.cs
+++ b/src/Spring/Spring.Data/Transaction/Support/TransactionTemplate.cs
@@ -200,7 +200,7 @@ namespace Spring.Transaction.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Initiating transaction rollback on application exception", exception);
+ log.LogDebug(exception, "Initiating transaction rollback on application exception");
}
try
{
@@ -208,7 +208,7 @@ namespace Spring.Transaction.Support
}
catch ( Exception ex )
{
- log.Error("Application exception overridden by rollback exception", ex);
+ log.LogError(ex, "Application exception overridden by rollback exception");
throw;
}
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnection.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnection.cs
index 44fea797..c381700f 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnection.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Common/EmsConnection.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
namespace Spring.Messaging.Ems.Common
{
@@ -195,7 +196,7 @@ namespace Spring.Messaging.Ems.Common
}
else
{
- logger.Error("No exception handler registered with EmsConnection wrapper class.", arg.Exception);
+ logger.LogError((Exception) arg.Exception, "No exception handler registered with EmsConnection wrapper class.");
}
}
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs
index d1098a3c..4362e1cf 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachedSession.cs
@@ -95,7 +95,7 @@ namespace Spring.Messaging.Ems.Connections
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Found cached MessageProducer for destination [" + destination + "]");
+ LOG.LogDebug("Found cached MessageProducer for destination [" + destination + "]");
}
#endregion
@@ -107,7 +107,7 @@ namespace Spring.Messaging.Ems.Connections
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Creating cached MessageProducer for destination [" + destination + "]");
+ LOG.LogDebug("Creating cached MessageProducer for destination [" + destination + "]");
}
#endregion
@@ -179,7 +179,7 @@ namespace Spring.Messaging.Ems.Connections
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Returning cached Session: " + target);
+ LOG.LogDebug("Returning cached Session: " + target);
}
#endregion
@@ -192,7 +192,7 @@ namespace Spring.Messaging.Ems.Connections
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Closing cached Session: " + this.target);
+ LOG.LogDebug("Closing cached Session: " + this.target);
}
// Explicitly close all MessageProducers and MessageConsumers that
// this Session happens to cache...
@@ -310,7 +310,7 @@ namespace Spring.Messaging.Ems.Connections
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Found cached EMS MessageConsumer for destination [" + destination + "]: " + consumer);
+ LOG.LogDebug("Found cached EMS MessageConsumer for destination [" + destination + "]: " + consumer);
}
}
else
@@ -327,7 +327,7 @@ namespace Spring.Messaging.Ems.Connections
}
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Creating cached EMS MessageConsumer for destination [" + destination + "]: " + consumer);
+ LOG.LogDebug("Creating cached EMS MessageConsumer for destination [" + destination + "]: " + consumer);
}
cachedConsumers[cacheKey] = consumer;
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs
index 6c07df04..1e28bbf4 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/CachingConnectionFactory.cs
@@ -232,8 +232,8 @@ namespace Spring.Messaging.Ems.Connections
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Found cached Session for mode " + mode + ": "
- + (session is IDecoratorSession ? ((IDecoratorSession) session).TargetSession : session));
+ LOG.LogDebug("Found cached Session for mode " + mode + ": "
+ + (session is IDecoratorSession ? ((IDecoratorSession) session).TargetSession : session));
}
}
else
@@ -241,7 +241,7 @@ namespace Spring.Messaging.Ems.Connections
ISession targetSession = CreateSession(con, mode);
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Creating cached Session for mode " + mode + ": " + targetSession);
+ LOG.LogDebug("Creating cached Session for mode " + mode + ": " + targetSession);
}
session = GetCachedSessionWrapper(targetSession, sessionList);
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/ConnectionFactoryUtils.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/ConnectionFactoryUtils.cs
index 1c9e545f..bc4b70b2 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/ConnectionFactoryUtils.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/ConnectionFactoryUtils.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Messaging.Ems.Common;
using Spring.Messaging.Ems.Support;
using Spring.Transaction.Support;
@@ -63,7 +64,7 @@ namespace Spring.Messaging.Ems.Connections
}
catch (Exception ex)
{
- LOG.Debug("Could not stop EMS Connection before closing it", ex);
+ LOG.LogDebug(ex, "Could not stop EMS Connection before closing it");
}
}
@@ -73,7 +74,7 @@ namespace Spring.Messaging.Ems.Connections
}
catch (Exception ex)
{
- LOG.Debug("Could not close EMS Connection", ex);
+ LOG.LogDebug(ex, "Could not close EMS Connection");
}
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/EmsResourceHolder.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/EmsResourceHolder.cs
index 25951126..be52af82 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/EmsResourceHolder.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/EmsResourceHolder.cs
@@ -19,6 +19,7 @@
#endregion
using System.Collections;
+using Microsoft.Extensions.Logging;
using Spring.Collections;
using Spring.Messaging.Ems.Common;
using Spring.Transaction.Support;
@@ -264,7 +265,7 @@ namespace Spring.Messaging.Ems.Connections
}
catch (Exception ex)
{
- logger.Debug("Could not close EMS Session after transaction", ex);
+ logger.LogDebug(ex, "Could not close EMS Session after transaction");
}
}
foreach (IConnection connection in connections)
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/EmsTransactionManager.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/EmsTransactionManager.cs
index 3798c5aa..9f3b1645 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/EmsTransactionManager.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/EmsTransactionManager.cs
@@ -180,7 +180,7 @@ namespace Spring.Messaging.Ems.Connections
session = CreateSession(con);
if (LOG.IsEnabled(LogLevel.Debug))
{
- log.Debug("Created EMS transaction on Session [" + session + "] from Connection [" + con + "]");
+ log.LogDebug("Created EMS transaction on Session [" + session + "] from Connection [" + con + "]");
}
txObject.ResourceHolder = new EmsResourceHolder(ConnectionFactory, con, session);
txObject.ResourceHolder.SynchronizedWithTransaction = true;
@@ -270,7 +270,7 @@ namespace Spring.Messaging.Ems.Connections
{
if (status.Debug)
{
- LOG.Debug("Committing EMS transaction on Session [" + session + "]");
+ LOG.LogDebug("Committing EMS transaction on Session [" + session + "]");
}
session.Commit();
}
@@ -299,7 +299,7 @@ namespace Spring.Messaging.Ems.Connections
{
if (status.Debug)
{
- LOG.Debug("Rolling back EMS transaction on Session [" + session + "]");
+ LOG.LogDebug("Rolling back EMS transaction on Session [" + session + "]");
}
session.Rollback();
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs
index 2c60716d..d8dab7a3 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Connections/SingleConnectionFactory.cs
@@ -462,7 +462,7 @@ namespace Spring.Messaging.Ems.Connections
PrepareConnection(this.target);
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Info("Established shared EMS Connection: " + this.target);
+ LOG.LogInformation("Established shared EMS Connection: " + this.target);
}
this.connection = GetSharedConnection(target);
}
@@ -532,7 +532,7 @@ namespace Spring.Messaging.Ems.Connections
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Closing shared EMS Connection: " + this.target);
+ LOG.LogDebug("Closing shared EMS Connection: " + this.target);
}
try
{
@@ -549,7 +549,7 @@ namespace Spring.Messaging.Ems.Connections
}
} catch (Exception ex)
{
- LOG.Warn("Could not close shared EMS connection.", ex);
+ LOG.LogWarning(ex, "Could not close shared EMS connection.");
}
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Core/EmsTemplate.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Core/EmsTemplate.cs
index 198b4640..056c053e 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Core/EmsTemplate.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Core/EmsTemplate.cs
@@ -209,7 +209,7 @@ namespace Spring.Messaging.Ems.Core
}
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Executing callback on EMS Session [" + sessionToUse + "]");
+ logger.LogDebug("Executing callback on EMS Session [" + sessionToUse + "]");
}
return action(sessionToUse);
}
@@ -688,7 +688,7 @@ namespace Spring.Messaging.Ems.Core
}
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Sending created message [" + message + "]");
+ logger.LogDebug("Sending created message [" + message + "]");
}
DoSend(producer, message);
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLocatorSupport.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLocatorSupport.cs
index 9e9da3cb..34a77e15 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLocatorSupport.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLocatorSupport.cs
@@ -33,7 +33,7 @@ namespace Spring.Messaging.Ems.Jndi
object jndiObject = Lookup(jndiName, null);
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Located object with JNDI name [" + jndiName + "]");
+ logger.LogDebug("Located object with JNDI name [" + jndiName + "]");
}
return jndiObject;
}
@@ -53,7 +53,7 @@ namespace Spring.Messaging.Ems.Jndi
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Located object with JNDI name [" + jndiName + "]");
+ logger.LogDebug("Located object with JNDI name [" + jndiName + "]");
}
return jndiObject;
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLookupFactoryObject.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLookupFactoryObject.cs
index 1eda311c..abf57261 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLookupFactoryObject.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Jndi/JndiLookupFactoryObject.cs
@@ -132,11 +132,11 @@ namespace Spring.Messaging.Ems.Jndi
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("JNDI lookup failed - returning specified default object instead", ex);
+ logger.LogDebug((Exception) ex, "JNDI lookup failed - returning specified default object instead");
}
else if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("JNDI lookup failed - returning specified default object instead: " + ex);
+ logger.LogInformation("JNDI lookup failed - returning specified default object instead: " + ex);
}
return this.defaultObject;
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/AbstractListenerContainer.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/AbstractListenerContainer.cs
index 2a40c83a..22a5c782 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/AbstractListenerContainer.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/AbstractListenerContainer.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Context;
using Spring.Messaging.Ems.Common;
using Spring.Messaging.Ems.Connections;
@@ -277,7 +278,7 @@ namespace Spring.Messaging.Ems.Listener
///
public virtual void Shutdown()
{
- logger.Debug("Shutting down message listener container");
+ logger.LogDebug("Shutting down message listener container");
bool wasRunning = false;
lock (this.lifecycleMonitor)
{
@@ -294,7 +295,7 @@ namespace Spring.Messaging.Ems.Listener
StopSharedConnection();
} catch (Exception ex)
{
- logger.Debug("Could not stop EMS Connection on shutdown", ex);
+ logger.LogDebug(ex, "Could not stop EMS Connection on shutdown");
}
}
@@ -409,7 +410,7 @@ namespace Spring.Messaging.Ems.Listener
if (sharedConnection == null)
{
sharedConnection = CreateSharedConnection();
- logger.Debug("Established shared EMS Connection");
+ logger.LogDebug("Established shared EMS Connection");
}
}
}
@@ -495,7 +496,7 @@ namespace Spring.Messaging.Ems.Listener
}
catch (Exception ex)
{
- logger.Warn("Ignoring Connection start exception - assuming already started", ex);
+ logger.LogWarning(ex, "Ignoring Connection start exception - assuming already started");
}
}
}
@@ -518,7 +519,7 @@ namespace Spring.Messaging.Ems.Listener
}
catch (System.InvalidOperationException ex)
{
- logger.Warn("Ignoring Connection stop exception - assuming already stopped", ex);
+ logger.LogWarning(ex, "Ignoring Connection stop exception - assuming already stopped");
}
}
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/AbstractMessageListenerContainer.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/AbstractMessageListenerContainer.cs
index 5f8189eb..9cb8e85f 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/AbstractMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/AbstractMessageListenerContainer.cs
@@ -337,8 +337,8 @@ namespace Spring.Messaging.Ems.Listener
#region Logging
if (logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("Rejecting received message because of the listener container " +
- "having been stopped in the meantime: " + message);
+ logger.LogWarning("Rejecting received message because of the listener container " +
+ "having been stopped in the meantime: " + message);
}
#endregion
RollbackIfNecessary(session);
@@ -415,8 +415,8 @@ namespace Spring.Messaging.Ems.Listener
// Actually invoke the message listener
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Invoking listener with message of type [" + message.GetType() +
- "] and session [" + sessionToUse + "]");
+ logger.LogDebug("Invoking listener with message of type [" + message.GetType() +
+ "] and session [" + sessionToUse + "]");
}
listener.OnMessage(message, sessionToUse);
// Clean up specially exposed Session, if any
@@ -524,7 +524,7 @@ namespace Spring.Messaging.Ems.Listener
// Transacted session created by this container -> rollback
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Initiating transaction rollback on application exception");
+ logger.LogDebug("Initiating transaction rollback on application exception");
}
EmsUtils.RollbackIfNecessary(session);
}
@@ -535,7 +535,7 @@ namespace Spring.Messaging.Ems.Listener
}
catch (EMSException)
{
- logger.Error("Application exception overriden by rollback exception", ex);
+ logger.LogError(ex, "Application exception overriden by rollback exception");
throw;
}
}
@@ -572,7 +572,7 @@ namespace Spring.Messaging.Ems.Listener
{
// Rare case: listener thread failed after container shutdown.
// Log at debug level, to avoid spamming the shutdown log.
- logger.Debug("Listener exception after container shutdown", ex);
+ logger.LogDebug(ex, "Listener exception after container shutdown");
}
}
@@ -584,7 +584,7 @@ namespace Spring.Messaging.Ems.Listener
}
else if (logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("Execution of EMS message listener failed, and no ErrorHandler has been set.", exception);
+ logger.LogWarning(exception, "Execution of EMS message listener failed, and no ErrorHandler has been set.");
}
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/Adapter/MessageListenerAdapter.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/Adapter/MessageListenerAdapter.cs
index 5163beb2..ebfd901b 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/Adapter/MessageListenerAdapter.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/Adapter/MessageListenerAdapter.cs
@@ -312,7 +312,7 @@ namespace Spring.Messaging.Ems.Listener.Adapter
}
else
{
- logger.Debug("No result object given - no result to handle");
+ logger.LogDebug("No result object given - no result to handle");
}
}
@@ -336,7 +336,7 @@ namespace Spring.Messaging.Ems.Listener.Adapter
/// The exception to handle.
protected virtual void HandleListenerException(Exception ex)
{
- logger.Error("Listener execution failed", ex);
+ logger.LogError(ex, "Listener execution failed");
}
///
@@ -384,8 +384,8 @@ namespace Spring.Messaging.Ems.Listener.Adapter
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Listener method returned result [" + result +
- "] - generating response message for it");
+ logger.LogDebug("Listener method returned result [" + result +
+ "] - generating response message for it");
}
Message response = BuildMessage(session, result);
PostProcessResponse(request, response);
@@ -396,8 +396,8 @@ namespace Spring.Messaging.Ems.Listener.Adapter
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Listener method returned result [" + result +
- "]: not generating response message for it because of no EMS Session given");
+ logger.LogDebug("Listener method returned result [" + result +
+ "]: not generating response message for it because of no EMS Session given");
}
}
}
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/SimpleMessageListenerContainer.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/SimpleMessageListenerContainer.cs
index efb6970e..89639473 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/SimpleMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Listener/SimpleMessageListenerContainer.cs
@@ -197,7 +197,7 @@ namespace Spring.Messaging.Ems.Listener
// now try to recover the shared Connection and all consumers...
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Trying to recover from EMS Connection exception: " + exception);
+ logger.LogInformation("Trying to recover from EMS Connection exception: " + exception);
}
try
{
@@ -208,15 +208,15 @@ namespace Spring.Messaging.Ems.Listener
}
RefreshConnectionUntilSuccessful();
InitializeConsumers();
- logger.Info("Successfully refreshed EMS Connection");
+ logger.LogInformation("Successfully refreshed EMS Connection");
}
catch (RecoveryTimeExceededException)
{
throw;
} catch (EMSException recoverEx)
{
- logger.Debug("Failed to recover EMS Connection", recoverEx);
- logger.Error("Encountered non-recoverable EMSException", exception);
+ logger.LogDebug((Exception) recoverEx, "Failed to recover EMS Connection");
+ logger.LogError((Exception) exception, "Encountered non-recoverable EMSException");
}
}
@@ -245,13 +245,13 @@ namespace Spring.Messaging.Ems.Listener
{
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Could not refresh Connection - retrying in " + recoveryInterval, ex);
+ logger.LogInformation("Could not refresh Connection - retrying in " + recoveryInterval);
}
}
if (totalTryTime > maxRecoveryTime)
{
- logger.Info("Could not refresh Connection after " + totalTryTime + ". Stopping reconnection attempts.");
+ logger.LogInformation("Could not refresh Connection after " + totalTryTime + ". Stopping reconnection attempts.");
throw new RecoveryTimeExceededException("Could not recover after " + totalTryTime);
}
@@ -326,7 +326,7 @@ namespace Spring.Messaging.Ems.Listener
{
if (consumers != null)
{
- logger.Debug("Closing EMS MessageConsumers");
+ logger.LogDebug("Closing EMS MessageConsumers");
foreach (IMessageConsumer messageConsumer in consumers)
{
EmsUtils.CloseMessageConsumer(messageConsumer);
@@ -334,7 +334,7 @@ namespace Spring.Messaging.Ems.Listener
}
if (sessions != null)
{
- logger.Debug("Closing EMS Sessions");
+ logger.LogDebug("Closing EMS Sessions");
foreach (ISession session in sessions)
{
EmsUtils.CloseSession(session);
diff --git a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/EmsUtils.cs b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/EmsUtils.cs
index 2cbce225..907c3c83 100644
--- a/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/EmsUtils.cs
+++ b/src/Spring/Spring.Messaging.Ems/Messaging/Ems/Support/EmsUtils.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Messaging.Ems.Common;
using Spring.Util;
@@ -76,12 +77,12 @@ namespace Spring.Messaging.Ems.Support
}
catch (EMSException ex)
{
- logger.Debug("Could not close EMS Connection", ex);
+ logger.LogDebug((Exception) ex, "Could not close EMS Connection");
}
catch (Exception ex)
{
// We don't trust the EMS provider: It might throw another exception.
- logger.Debug("Unexpected exception on closing EMS Connection", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing EMS Connection");
}
}
}
@@ -101,12 +102,12 @@ namespace Spring.Messaging.Ems.Support
}
catch (EMSException ex)
{
- logger.Debug("Could not close EMS Session", ex);
+ logger.LogDebug((Exception) ex, "Could not close EMS Session");
}
catch (Exception ex)
{
// We don't trust the EMS provider: It might throw RuntimeException or Error.
- logger.Debug("Unexpected exception on closing EMS Session", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing EMS Session");
}
}
}
@@ -126,12 +127,12 @@ namespace Spring.Messaging.Ems.Support
}
catch (EMSException ex)
{
- logger.Debug("Could not close EMS MessageProducer", ex);
+ logger.LogDebug((Exception) ex, "Could not close EMS MessageProducer");
}
catch (Exception ex)
{
// We don't trust the provider: It might throw an exception .
- logger.Debug("Unexpected exception on closing EMS MessageProducer", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing EMS MessageProducer");
}
}
}
@@ -151,12 +152,12 @@ namespace Spring.Messaging.Ems.Support
}
catch (EMSException ex)
{
- logger.Debug("Could not close EMS MessageConsumer", ex);
+ logger.LogDebug((Exception) ex, "Could not close EMS MessageConsumer");
}
catch (Exception ex)
{
// We don't trust the EMS provider: It might throw RuntimeException or Error.
- logger.Debug("Unexpected exception on closing EMS MessageConsumer", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing EMS MessageConsumer");
}
}
}
@@ -251,10 +252,10 @@ namespace Spring.Messaging.Ems.Support
browser.Close();
} catch (EMSException ex)
{
- logger.Debug("Could not close EMS QueueBrowser", ex);
+ logger.LogDebug((Exception) ex, "Could not close EMS QueueBrowser");
} catch (Exception ex)
{
- logger.Debug("Unexpected exception on closing EMS QueueBrowser", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing EMS QueueBrowser");
}
}
}
@@ -284,7 +285,7 @@ namespace Spring.Messaging.Ems.Support
case Session.SESSION_TRANSACTED:
return SessionMode.SessionTransacted;
default:
- logger.Warn("Integer acknowledgement mode [" + ackMode + "] not valid. Defaulting to SessionMode.AutoAcknowledge");
+ logger.LogWarning("Integer acknowledgement mode [" + ackMode + "] not valid. Defaulting to SessionMode.AutoAcknowledge");
return SessionMode.AutoAcknowledge;
}
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/CachedSession.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/CachedSession.cs
index a48ca2e6..0a40b2d0 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/CachedSession.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/CachedSession.cs
@@ -89,14 +89,14 @@ namespace Spring.Messaging.Nms.Connections
{
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Found cached MessageProducer for unspecified destination");
+ Log.LogDebug("Found cached MessageProducer for unspecified destination");
}
}
else
{
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Creating cached MessageProducer for unspecified destination");
+ Log.LogDebug("Creating cached MessageProducer for unspecified destination");
}
cachedUnspecifiedDestinationMessageProducer = await target.CreateProducerAsync().Awaiter();
@@ -131,7 +131,7 @@ namespace Spring.Messaging.Nms.Connections
{
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Found cached MessageProducer for destination [" + destination + "]");
+ Log.LogDebug("Found cached MessageProducer for destination [" + destination + "]");
}
}
else
@@ -140,7 +140,7 @@ namespace Spring.Messaging.Nms.Connections
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Creating cached MessageProducer for destination [" + destination + "]");
+ Log.LogDebug("Creating cached MessageProducer for destination [" + destination + "]");
}
cachedProducers[destination] = producer;
@@ -219,7 +219,7 @@ namespace Spring.Messaging.Nms.Connections
{
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Returning cached Session: " + target);
+ Log.LogDebug("Returning cached Session: " + target);
}
sessionList.Add(this); //add to end of linked list.
@@ -230,7 +230,7 @@ namespace Spring.Messaging.Nms.Connections
{
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Closing cached Session: " + target);
+ Log.LogDebug("Closing cached Session: " + target);
}
// Explicitly close all MessageProducers and MessageConsumers that
// this Session happens to cache...
@@ -450,7 +450,7 @@ namespace Spring.Messaging.Nms.Connections
{
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Found cached NMS MessageConsumer for destination [" + destination + "]: " + consumer);
+ Log.LogDebug("Found cached NMS MessageConsumer for destination [" + destination + "]: " + consumer);
}
}
else
@@ -475,7 +475,7 @@ namespace Spring.Messaging.Nms.Connections
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Creating cached NMS MessageConsumer for destination [" + destination + "]: " + consumer);
+ Log.LogDebug("Creating cached NMS MessageConsumer for destination [" + destination + "]: " + consumer);
}
cachedConsumers[cacheKey] = consumer;
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/CachingConnectionFactory.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/CachingConnectionFactory.cs
index b5011f36..c318ffb2 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/CachingConnectionFactory.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/CachingConnectionFactory.cs
@@ -218,8 +218,9 @@ namespace Spring.Messaging.Nms.Connections
{
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Found cached Session for mode " + mode + ": "
- + (session is IDecoratorSession decoratorSession ? decoratorSession.TargetSession : session));
+ string message = "Found cached Session for mode " + mode + ": "
+ + (session is IDecoratorSession decoratorSession ? decoratorSession.TargetSession : session);
+ Log.LogDebug(message);
}
}
else
@@ -227,7 +228,7 @@ namespace Spring.Messaging.Nms.Connections
ISession targetSession = await con.CreateSessionAsync(mode).Awaiter();
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug("Creating cached Session for mode " + mode + ": " + targetSession);
+ Log.LogDebug("Creating cached Session for mode " + mode + ": " + targetSession);
}
session = GetCachedSessionWrapper(targetSession, sessionList);
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/ConnectionFactoryUtils.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/ConnectionFactoryUtils.cs
index b7ca411a..e6c2692b 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/ConnectionFactoryUtils.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/ConnectionFactoryUtils.cs
@@ -19,6 +19,7 @@
#endregion
using Apache.NMS;
+using Microsoft.Extensions.Logging;
using Spring.Messaging.Nms.Support;
using Spring.Transaction.Support;
using Spring.Util;
@@ -63,7 +64,7 @@ namespace Spring.Messaging.Nms.Connections
}
catch (Exception ex)
{
- LOG.Debug("Could not stop NMS Connection before closing it", ex);
+ LOG.LogDebug(ex, "Could not stop NMS Connection before closing it");
}
}
@@ -72,7 +73,7 @@ namespace Spring.Messaging.Nms.Connections
connection.Close();
} catch (Exception ex)
{
- LOG.Debug("Could not close NMS Connection", ex);
+ LOG.LogDebug(ex, "Could not close NMS Connection");
}
}
@@ -101,7 +102,7 @@ namespace Spring.Messaging.Nms.Connections
}
catch (Exception ex)
{
- LOG.Debug("Could not stop NMS Connection before closing it", ex);
+ LOG.LogDebug(ex, "Could not stop NMS Connection before closing it");
}
}
@@ -110,7 +111,7 @@ namespace Spring.Messaging.Nms.Connections
await connection.CloseAsync().Awaiter();
} catch (Exception ex)
{
- LOG.Debug("Could not close NMS Connection", ex);
+ LOG.LogDebug(ex, "Could not close NMS Connection");
}
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsResourceHolder.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsResourceHolder.cs
index 17449f4a..e6d82051 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsResourceHolder.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsResourceHolder.cs
@@ -17,6 +17,7 @@
using Spring.Transaction.Support;
using Spring.Util;
using Apache.NMS;
+using Microsoft.Extensions.Logging;
using Spring.Messaging.Nms.Support;
namespace Spring.Messaging.Nms.Connections
@@ -231,7 +232,7 @@ namespace Spring.Messaging.Nms.Connections
}
catch (Exception ex)
{
- logger.Debug("Could not close NMS ISession after transaction", ex);
+ logger.LogDebug(ex, "Could not close NMS ISession after transaction");
}
}
foreach (IConnection connection in connections)
@@ -267,7 +268,7 @@ namespace Spring.Messaging.Nms.Connections
}
catch (Exception ex)
{
- logger.Debug("Could not close NMS ISession after transaction", ex);
+ logger.LogDebug(ex, "Could not close NMS ISession after transaction");
}
}
foreach (IConnection connection in connections)
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsTransactionManager.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsTransactionManager.cs
index 8d5f5cbb..927c8637 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsTransactionManager.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/NmsTransactionManager.cs
@@ -197,7 +197,7 @@ namespace Spring.Messaging.Nms.Connections
session = CreateSession(con);
if (LOG.IsEnabled(LogLevel.Debug))
{
- log.Debug("Created NMS transaction on Session [" + session + "] from Connection [" + con + "]");
+ log.LogDebug("Created NMS transaction on Session [" + session + "] from Connection [" + con + "]");
}
txObject.ResourceHolder = new NmsResourceHolder(ConnectionFactory, con, session);
txObject.ResourceHolder.SynchronizedWithTransaction = true;
@@ -287,7 +287,7 @@ namespace Spring.Messaging.Nms.Connections
{
if (status.Debug)
{
- LOG.Debug("Committing NMS transaction on Session [" + session + "]");
+ LOG.LogDebug("Committing NMS transaction on Session [" + session + "]");
}
session.Commit();
//Note that NMS does not have, TransactionRolledBackException
@@ -314,7 +314,7 @@ namespace Spring.Messaging.Nms.Connections
{
if (status.Debug)
{
- LOG.Debug("Rolling back NMS transaction on Session [" + session + "]");
+ LOG.LogDebug("Rolling back NMS transaction on Session [" + session + "]");
}
session.Rollback();
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs
index 99db1515..99795c76 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Connections/SingleConnectionFactory.cs
@@ -376,7 +376,7 @@ namespace Spring.Messaging.Nms.Connections
PrepareConnection(this.target);
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Info("Established shared NMS Connection: " + this.target);
+ LOG.LogInformation("Established shared NMS Connection: " + this.target);
}
this.connection = GetSharedConnection(target, acquireLock);
@@ -452,7 +452,7 @@ namespace Spring.Messaging.Nms.Connections
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Closing shared NMS Connection: " + this.target);
+ LOG.LogDebug("Closing shared NMS Connection: " + this.target);
}
try
@@ -472,7 +472,7 @@ namespace Spring.Messaging.Nms.Connections
}
catch (Exception ex)
{
- LOG.Warn("Could not close shared NMS connection.", ex);
+ LOG.LogWarning(ex, "Could not close shared NMS connection.");
}
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs
index 319dce54..aed516a5 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplate.cs
@@ -187,7 +187,7 @@ namespace Spring.Messaging.Nms.Core
}
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Executing callback on NMS ISession [" + sessionToUse + "]");
+ logger.LogDebug("Executing callback on NMS ISession [" + sessionToUse + "]");
}
return action.DoInNms(sessionToUse);
}
@@ -563,7 +563,7 @@ namespace Spring.Messaging.Nms.Core
}
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Sending created message [" + message + "]");
+ logger.LogDebug("Sending created message [" + message + "]");
}
DoSend(producer, message);
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplateAsync.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplateAsync.cs
index 1a68daa3..d76c7937 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplateAsync.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTemplateAsync.cs
@@ -172,7 +172,7 @@ namespace Spring.Messaging.Nms.Core
}
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Executing callback on NMS ISession [" + sessionToUse + "]");
+ logger.LogDebug("Executing callback on NMS ISession [" + sessionToUse + "]");
}
return await action.DoInNms(sessionToUse).Awaiter();
}
@@ -546,7 +546,7 @@ namespace Spring.Messaging.Nms.Core
}
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Sending created message [" + message + "]");
+ logger.LogDebug("Sending created message [" + message + "]");
}
await DoSend(producer, message).Awaiter();
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTrace.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTrace.cs
index 95e1685c..7a07ccaa 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTrace.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Core/NmsTrace.cs
@@ -62,7 +62,7 @@ namespace Spring.Messaging.Nms.Core
/// The message.
public void Debug(string message)
{
- log.Debug(message);
+ log.LogDebug(message);
}
///
@@ -71,7 +71,7 @@ namespace Spring.Messaging.Nms.Core
/// The message.
public void Info(string message)
{
- log.Info(message);
+ log.LogInformation(message);
}
///
@@ -80,7 +80,7 @@ namespace Spring.Messaging.Nms.Core
/// The message.
public void Warn(string message)
{
- log.Warn(message);
+ log.LogWarning(message);
}
///
@@ -89,7 +89,7 @@ namespace Spring.Messaging.Nms.Core
/// The message.
public void Error(string message)
{
- log.Error(message);
+ log.LogError(message);
}
///
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractListenerContainer.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractListenerContainer.cs
index 7f92f5ad..80c3c9e8 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractListenerContainer.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractListenerContainer.cs
@@ -20,6 +20,7 @@
using System.Runtime.Serialization;
using Apache.NMS;
+using Microsoft.Extensions.Logging;
using Spring.Context;
using Spring.Messaging.Nms.Connections;
using Spring.Messaging.Nms.Support;
@@ -277,7 +278,7 @@ namespace Spring.Messaging.Nms.Listener
///
public virtual void Shutdown()
{
- logger.Debug("Shutting down message listener container");
+ logger.LogDebug("Shutting down message listener container");
bool wasRunning = false;
lock (this.lifecycleMonitor)
{
@@ -294,7 +295,7 @@ namespace Spring.Messaging.Nms.Listener
StopSharedConnection();
} catch (Exception ex)
{
- logger.Debug("Could not stop NMS Connection on shutdown", ex);
+ logger.LogDebug(ex, "Could not stop NMS Connection on shutdown");
}
}
@@ -409,7 +410,7 @@ namespace Spring.Messaging.Nms.Listener
if (sharedConnection == null)
{
sharedConnection = CreateSharedConnection();
- logger.Debug("Established shared NMS Connection");
+ logger.LogDebug("Established shared NMS Connection");
}
}
}
@@ -495,7 +496,7 @@ namespace Spring.Messaging.Nms.Listener
}
catch (Exception ex)
{
- logger.Warn("Ignoring Connection start exception - assuming already started", ex);
+ logger.LogWarning(ex, "Ignoring Connection start exception - assuming already started");
}
}
}
@@ -518,7 +519,7 @@ namespace Spring.Messaging.Nms.Listener
}
catch (System.InvalidOperationException ex)
{
- logger.Warn("Ignoring Connection stop exception - assuming already stopped", ex);
+ logger.LogWarning(ex, "Ignoring Connection stop exception - assuming already stopped");
}
}
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractMessageListenerContainer.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractMessageListenerContainer.cs
index 134043e6..4a71438b 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/AbstractMessageListenerContainer.cs
@@ -341,8 +341,8 @@ namespace Spring.Messaging.Nms.Listener
#region Logging
if (logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("Rejecting received message because of the listener container " +
- "having been stopped in the meantime: " + message);
+ logger.LogWarning("Rejecting received message because of the listener container " +
+ "having been stopped in the meantime: " + message);
}
#endregion
RollbackIfNecessary(session);
@@ -418,8 +418,8 @@ namespace Spring.Messaging.Nms.Listener
// Actually invoke the message listener
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Invoking listener with message of type [" + message.GetType() +
- "] and session [" + sessionToUse + "]");
+ logger.LogDebug("Invoking listener with message of type [" + message.GetType() +
+ "] and session [" + sessionToUse + "]");
}
listener.OnMessage(message, sessionToUse);
// Clean up specially exposed Session, if any
@@ -527,7 +527,7 @@ namespace Spring.Messaging.Nms.Listener
// Transacted session created by this container -> rollback
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Initiating transaction rollback on application exception");
+ logger.LogDebug("Initiating transaction rollback on application exception");
}
NmsUtils.RollbackIfNecessary(session);
}
@@ -538,7 +538,7 @@ namespace Spring.Messaging.Nms.Listener
}
catch (NMSException)
{
- logger.Error("Application exception overriden by rollback exception", ex);
+ logger.LogError(ex, "Application exception overriden by rollback exception");
throw;
}
}
@@ -575,7 +575,7 @@ namespace Spring.Messaging.Nms.Listener
{
// Rare case: listener thread failed after container shutdown.
// Log at debug level, to avoid spamming the shutdown log.
- logger.Debug("Listener exception after container shutdown", ex);
+ logger.LogDebug(ex, "Listener exception after container shutdown");
}
}
@@ -591,7 +591,7 @@ namespace Spring.Messaging.Nms.Listener
}
else if(logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("Execution of NMS message listener failed, and no ErrorHandler has been set.", exception);
+ logger.LogWarning(exception, "Execution of NMS message listener failed, and no ErrorHandler has been set.");
}
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/Adapter/MessageListenerAdapter.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/Adapter/MessageListenerAdapter.cs
index 66ef7f58..d33f4f73 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/Adapter/MessageListenerAdapter.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/Adapter/MessageListenerAdapter.cs
@@ -334,7 +334,7 @@ namespace Spring.Messaging.Nms.Listener.Adapter
}
else
{
- logger.Debug("No result object given - no result to handle");
+ logger.LogDebug("No result object given - no result to handle");
}
}
@@ -358,7 +358,7 @@ namespace Spring.Messaging.Nms.Listener.Adapter
/// The exception to handle.
protected virtual void HandleListenerException(Exception ex)
{
- logger.Error("Listener execution failed", ex);
+ logger.LogError(ex, "Listener execution failed");
}
///
@@ -406,8 +406,8 @@ namespace Spring.Messaging.Nms.Listener.Adapter
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Listener method returned result [" + result +
- "] - generating response message for it");
+ logger.LogDebug("Listener method returned result [" + result +
+ "] - generating response message for it");
}
IMessage response = BuildMessage(session, result);
PostProcessResponse(request, response);
@@ -418,8 +418,8 @@ namespace Spring.Messaging.Nms.Listener.Adapter
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Listener method returned result [" + result +
- "]: not generating response message for it because of no NMS ISession given");
+ logger.LogDebug("Listener method returned result [" + result +
+ "]: not generating response message for it because of no NMS ISession given");
}
}
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs
index 252d68e4..71042d84 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Listener/SimpleMessageListenerContainer.cs
@@ -195,7 +195,7 @@ namespace Spring.Messaging.Nms.Listener
// now try to recover the shared Connection and all consumers...
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Trying to recover from NMS Connection exception: " + exception);
+ logger.LogInformation("Trying to recover from NMS Connection exception: " + exception);
}
try
{
@@ -206,14 +206,14 @@ namespace Spring.Messaging.Nms.Listener
}
RefreshConnectionUntilSuccessful();
InitializeConsumers();
- logger.Info("Successfully refreshed NMS Connection");
+ logger.LogInformation("Successfully refreshed NMS Connection");
} catch (RecoveryTimeExceededException)
{
throw;
} catch (Exception recoverEx)
{
- logger.Debug("Failed to recover NMS Connection", recoverEx);
- logger.Error("Encountered non-recoverable Exception", exception);
+ logger.LogDebug(recoverEx, "Failed to recover NMS Connection");
+ logger.LogError(exception, "Encountered non-recoverable Exception");
throw;
}
}
@@ -248,7 +248,7 @@ namespace Spring.Messaging.Nms.Listener
if (totalTryTime > maxRecoveryTime)
{
- logger.Info("Could not refresh Connection after " + totalTryTime + ". Stopping reconnection attempts.");
+ logger.LogInformation("Could not refresh Connection after " + totalTryTime + ". Stopping reconnection attempts.");
throw new RecoveryTimeExceededException("Could not recover after " + totalTryTime);
}
@@ -325,7 +325,7 @@ namespace Spring.Messaging.Nms.Listener
{
if (consumers != null)
{
- logger.Debug("Closing NMS MessageConsumers");
+ logger.LogDebug("Closing NMS MessageConsumers");
foreach (IMessageConsumer messageConsumer in consumers)
{
NmsUtils.CloseMessageConsumer(messageConsumer);
@@ -333,7 +333,7 @@ namespace Spring.Messaging.Nms.Listener
}
if (sessions != null)
{
- logger.Debug("Closing NMS Sessions");
+ logger.LogDebug("Closing NMS Sessions");
foreach (ISession session in sessions)
{
NmsUtils.CloseSession(session);
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtils.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtils.cs
index f146e836..f52faf5e 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtils.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtils.cs
@@ -20,6 +20,7 @@
using Spring.Util;
using Apache.NMS;
+using Microsoft.Extensions.Logging;
namespace Spring.Messaging.Nms.Support
{
@@ -76,12 +77,12 @@ namespace Spring.Messaging.Nms.Support
}
catch (NMSException ex)
{
- logger.Debug("Could not close NMS Connection", ex);
+ logger.LogDebug(ex, "Could not close NMS Connection");
}
catch (Exception ex)
{
// We don't trust the NMS provider: It might throw another exception.
- logger.Debug("Unexpected exception on closing NMS Connection", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing NMS Connection");
}
}
}
@@ -101,12 +102,12 @@ namespace Spring.Messaging.Nms.Support
}
catch (NMSException ex)
{
- logger.Debug("Could not close NMS ISession", ex);
+ logger.LogDebug(ex, "Could not close NMS ISession");
}
catch (Exception ex)
{
// We don't trust the NMS provider: It might throw RuntimeException or Error.
- logger.Debug("Unexpected exception on closing NMS ISession", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing NMS ISession");
}
}
}
@@ -126,12 +127,12 @@ namespace Spring.Messaging.Nms.Support
}
catch (NMSException ex)
{
- logger.Debug("Could not close NMS MessageProducer", ex);
+ logger.LogDebug(ex, "Could not close NMS MessageProducer");
}
catch (Exception ex)
{
// We don't trust the NMS provider: It might throw RuntimeException or Error.
- logger.Debug("Unexpected exception on closing NMS MessageProducer", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing NMS MessageProducer");
}
}
}
@@ -151,12 +152,12 @@ namespace Spring.Messaging.Nms.Support
}
catch (NMSException ex)
{
- logger.Debug("Could not close NMS MessageConsumer", ex);
+ logger.LogDebug(ex, "Could not close NMS MessageConsumer");
}
catch (Exception ex)
{
// We don't trust the NMS provider: It might throw RuntimeException or Error.
- logger.Debug("Unexpected exception on closing NMS MessageConsumer", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing NMS MessageConsumer");
}
}
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtilsAsync.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtilsAsync.cs
index c53bd7ba..301f8d89 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtilsAsync.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/MessageUtilsAsync.cs
@@ -18,6 +18,7 @@
using Spring.Util;
using Apache.NMS;
+using Microsoft.Extensions.Logging;
namespace Spring.Messaging.Nms.Support
{
@@ -74,12 +75,12 @@ namespace Spring.Messaging.Nms.Support
}
catch (NMSException ex)
{
- logger.Debug("Could not close NMS Connection", ex);
+ logger.LogDebug(ex, "Could not close NMS Connection");
}
catch (Exception ex)
{
// We don't trust the NMS provider: It might throw another exception.
- logger.Debug("Unexpected exception on closing NMS Connection", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing NMS Connection");
}
}
}
@@ -99,12 +100,12 @@ namespace Spring.Messaging.Nms.Support
}
catch (NMSException ex)
{
- logger.Debug("Could not close NMS ISession", ex);
+ logger.LogDebug(ex, "Could not close NMS ISession");
}
catch (Exception ex)
{
// We don't trust the NMS provider: It might throw RuntimeException or Error.
- logger.Debug("Unexpected exception on closing NMS ISession", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing NMS ISession");
}
}
}
@@ -124,12 +125,12 @@ namespace Spring.Messaging.Nms.Support
}
catch (NMSException ex)
{
- logger.Debug("Could not close NMS MessageProducer", ex);
+ logger.LogDebug(ex, "Could not close NMS MessageProducer");
}
catch (Exception ex)
{
// We don't trust the NMS provider: It might throw RuntimeException or Error.
- logger.Debug("Unexpected exception on closing NMS MessageProducer", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing NMS MessageProducer");
}
}
}
@@ -151,12 +152,12 @@ namespace Spring.Messaging.Nms.Support
}
catch (NMSException ex)
{
- logger.Debug("Could not close NMS MessageConsumer", ex);
+ logger.LogDebug(ex, "Could not close NMS MessageConsumer");
}
catch (Exception ex)
{
// We don't trust the NMS provider: It might throw RuntimeException or Error.
- logger.Debug("Unexpected exception on closing NMS MessageConsumer", ex);
+ logger.LogDebug(ex, "Unexpected exception on closing NMS MessageConsumer");
}
}
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessor.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessor.cs
index 1b8096be..055a4063 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessor.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessor.cs
@@ -138,7 +138,7 @@ namespace Spring.Messaging.Nms.Support
{
if (logger.IsEnabled(LogLevel.Trace))
{
- logger.Trace("Setting Apache.NMS.Tracer.Trace to default implementation that directs output to Common.Logging");
+ logger.LogTrace("Setting Apache.NMS.Tracer.Trace to default implementation that directs output to Common.Logging");
}
Tracer.Trace = new NmsTrace();
}
diff --git a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessorAsync.cs b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessorAsync.cs
index 74b7c015..71d0f1aa 100644
--- a/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessorAsync.cs
+++ b/src/Spring/Spring.Messaging.Nms/Messaging/Nms/Support/NmsAccessorAsync.cs
@@ -131,7 +131,7 @@ namespace Spring.Messaging.Nms.Support
{
if (logger.IsEnabled(LogLevel.Trace))
{
- logger.Trace("Setting Apache.NMS.Tracer.Trace to default implementation that directs output to Common.Logging");
+ logger.LogTrace("Setting Apache.NMS.Tracer.Trace to default implementation that directs output to Common.Logging");
}
Tracer.Trace = new NmsTrace();
}
diff --git a/src/Spring/Spring.Messaging/Messaging/Core/DefaultMessageQueueFactory.cs b/src/Spring/Spring.Messaging/Messaging/Core/DefaultMessageQueueFactory.cs
index 21f7cd66..e1110b8e 100644
--- a/src/Spring/Spring.Messaging/Messaging/Core/DefaultMessageQueueFactory.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Core/DefaultMessageQueueFactory.cs
@@ -19,6 +19,7 @@
#endregion
using System.Collections;
+using Microsoft.Extensions.Logging;
using Spring.Context;
using Spring.Messaging.Support;
using Spring.Messaging.Support.Converters;
@@ -148,7 +149,7 @@ namespace Spring.Messaging.Core
applicationContext.GetObject(messageConverterObjectName, typeof (IMessageConverter));
if (applicationContext.ObjectFactory.GetObjectDefinition(messageConverterObjectName).IsSingleton)
{
- log.Warn("MessageConverter with name = [" + messageConverterObjectName + "] should be declared with singleton=false. Using Clone() to create independent instance for thread local storage");
+ log.LogWarning("MessageConverter with name = [" + messageConverterObjectName + "] should be declared with singleton=false. Using Clone() to create independent instance for thread local storage");
converters.Add(messageConverterObjectName, mc.Clone());
}
else
diff --git a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueMetadataCache.cs b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueMetadataCache.cs
index 3f291267..eaa52780 100644
--- a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueMetadataCache.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueMetadataCache.cs
@@ -71,16 +71,15 @@ namespace Spring.Messaging.Core
#region Logging
if (LOG.IsEnabled(LogLevel.Warning))
{
- LOG.Warn(
- "Path for MessageQueueFactoryObject named [" +
- mqfo.ObjectName + "] is null, so can't cache its metadata.");
+ LOG.LogWarning("Path for MessageQueueFactoryObject named [" +
+ mqfo.ObjectName + "] is null, so can't cache its metadata.");
}
#endregion
}
} else
{
// This would indicate some bug in GetObjectsOfType
- LOG.Error("Unexpected type of " + entry.Value.GetType() + " was given as candidate for caching MessageQueueMetadata.");
+ LOG.LogError("Unexpected type of " + entry.Value.GetType() + " was given as candidate for caching MessageQueueMetadata.");
}
}
isInitialized = true;
diff --git a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTemplate.cs b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTemplate.cs
index a0904c2b..7db03afd 100644
--- a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTemplate.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTemplate.cs
@@ -326,10 +326,9 @@ namespace Spring.Messaging.Core
if (LOG.IsEnabled(LogLevel.Warning))
{
- LOG.Warn(
- "The ApplicationContext property has not been set, so the MessageQueueMetadataCache can not be automatically generated. " +
- "Please explictly set the MessageQueueMetadataCache using the property MetadataCache or set the ApplicationContext property. " +
- "This will only effect the use of MessageQueueTemplate when publishing to remote queues.");
+ LOG.LogWarning("The ApplicationContext property has not been set, so the MessageQueueMetadataCache can not be automatically generated. " +
+ "Please explictly set the MessageQueueMetadataCache using the property MetadataCache or set the ApplicationContext property. " +
+ "This will only effect the use of MessageQueueTemplate when publishing to remote queues.");
}
#endregion
@@ -572,9 +571,9 @@ namespace Spring.Messaging.Core
{
if (LOG.IsEnabled(LogLevel.Warning))
{
- LOG.Warn("MetadataCache has not been initialized. Set the MetadataCache explicitly in standalone usage and/or " +
- "configure the MessageQueueTemplate in an ApplicationContext. If deployed in an ApplicationContext by default " +
- "the MetadataCache will automaticaly populated.");
+ LOG.LogWarning("MetadataCache has not been initialized. Set the MetadataCache explicitly in standalone usage and/or " +
+ "configure the MessageQueueTemplate in an ApplicationContext. If deployed in an ApplicationContext by default " +
+ "the MetadataCache will automaticaly populated.");
}
}
// Handle assuming these are local queues.
@@ -602,8 +601,7 @@ namespace Spring.Messaging.Core
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug(
- "Sending messsage using externally managed MessageQueueTransction to transactional queue with path [" + mq.Path + "].");
+ LOG.LogDebug("Sending messsage using externally managed MessageQueueTransction to transactional queue with path [" + mq.Path + "].");
}
mq.Send(msg, transactionToUse);
}
@@ -616,7 +614,7 @@ namespace Spring.Messaging.Core
* using a direct format name. In this situation, if you do not specify a
* transaction context when sending a message, one is not created for you
* and the message will be sent to the dead-letter queue.*/
- LOG.Warn("Sending message using implicit single-message transaction to transactional queue queue with path [" + mq.Path + "].");
+ LOG.LogWarning("Sending message using implicit single-message transaction to transactional queue queue with path [" + mq.Path + "].");
mq.Send(msg, MessageQueueTransactionType.Single);
}
}
@@ -631,14 +629,14 @@ namespace Spring.Messaging.Core
{
if (transactionToUse != null)
{
- LOG.Warn("Thread local message transaction ignored for sending to non-transactional queue with path [" + mq.Path + "].");
+ LOG.LogWarning("Thread local message transaction ignored for sending to non-transactional queue with path [" + mq.Path + "].");
mq.Send(msg);
}
else
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Sending messsage without MSMQ transaction to non-transactional queue with path [" + mq.Path + "].");
+ LOG.LogDebug("Sending messsage without MSMQ transaction to non-transactional queue with path [" + mq.Path + "].");
}
//Typical case, non TLS transaction, non-tx queue.
mq.Send(msg);
diff --git a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTransactionManager.cs b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTransactionManager.cs
index b235fbae..70125104 100644
--- a/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTransactionManager.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Core/MessageQueueTransactionManager.cs
@@ -185,7 +185,7 @@ namespace Spring.Messaging.Core
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Committing MessageQueueTransaction");
+ LOG.LogDebug("Committing MessageQueueTransaction");
}
transaction.Commit();
}
@@ -210,7 +210,7 @@ namespace Spring.Messaging.Core
{
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Committing MessageQueueTransaction");
+ LOG.LogDebug("Committing MessageQueueTransaction");
}
transaction.Abort();
}
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/AbstractListenerContainer.cs b/src/Spring/Spring.Messaging/Messaging/Listener/AbstractListenerContainer.cs
index b20f595b..075a0bb0 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/AbstractListenerContainer.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/AbstractListenerContainer.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Objects.Factory;
namespace Spring.Messaging.Listener
@@ -175,7 +176,7 @@ namespace Spring.Messaging.Listener
///
public virtual void Shutdown()
{
- LOG.Debug("Shutting down MessageListenerContainer");
+ LOG.LogDebug("Shutting down MessageListenerContainer");
lock (lifecycleMonitor)
{
running = false;
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/AbstractMessageListenerContainer.cs b/src/Spring/Spring.Messaging/Messaging/Listener/AbstractMessageListenerContainer.cs
index 29c2e401..e47fd24f 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/AbstractMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/AbstractMessageListenerContainer.cs
@@ -195,8 +195,8 @@ namespace Spring.Messaging.Listener
{
if (LOG.IsEnabled(LogLevel.Warning))
{
- LOG.Warn("Not processing recieved message because of the listener container " +
- "having been stopped in the meantime: " + message);
+ LOG.LogWarning("Not processing recieved message because of the listener container " +
+ "having been stopped in the meantime: " + message);
}
}
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/AbstractPeekingMessageListenerContainer.cs b/src/Spring/Spring.Messaging/Messaging/Listener/AbstractPeekingMessageListenerContainer.cs
index a8865fef..925e4e56 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/AbstractPeekingMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/AbstractPeekingMessageListenerContainer.cs
@@ -24,6 +24,7 @@ using Experimental.System.Messaging;
#else
using System.Messaging;
#endif
+using Microsoft.Extensions.Logging;
namespace Spring.Messaging.Listener
{
@@ -106,8 +107,8 @@ namespace Spring.Messaging.Listener
}
else
{
- LOG.Info("Ignoring resetting of MaxConcurrentListeners. Using previous value of " +
- maxConcurrentListeners);
+ LOG.LogInformation("Ignoring resetting of MaxConcurrentListeners. Using previous value of " +
+ maxConcurrentListeners);
}
}
}
@@ -144,10 +145,10 @@ namespace Spring.Messaging.Listener
CloseQueueHandle(MessageQueue);
if (dispatcherThread != null)
{
- LOG.Debug("Waiting to join dispatcher thread.");
+ LOG.LogDebug("Waiting to join dispatcher thread.");
dispatcherThread.Join();
dispatcherThread = null;
- LOG.Debug("Dispatcher thread terminated.");
+ LOG.LogDebug("Dispatcher thread terminated.");
}
}
@@ -173,10 +174,10 @@ namespace Spring.Messaging.Listener
CloseQueueHandle(MessageQueue);
if (dispatcherThread != null)
{
- LOG.Debug("Waiting to join dispatcher thread.");
+ LOG.LogDebug("Waiting to join dispatcher thread.");
dispatcherThread.Join();
dispatcherThread = null;
- LOG.Debug("Dispatcher thread terminated.");
+ LOG.LogDebug("Dispatcher thread terminated.");
}
}
@@ -195,7 +196,7 @@ namespace Spring.Messaging.Listener
try
{
IAsyncResult asynchResult = MessageQueue.BeginPeek();
- LOG.Debug("Waiting on Peek AsyncWaitHandle");
+ LOG.LogDebug("Waiting on Peek AsyncWaitHandle");
int firedWaitHandle = WaitHandle.WaitAny(new WaitHandle[] {asynchResult.AsyncWaitHandle, stopEvent});
if (firedWaitHandle == 0)
{
@@ -209,9 +210,9 @@ namespace Spring.Messaging.Listener
}
catch (Exception ex)
{
- LOG.Error(
- "Exception executing DefaultMessageQueue.BeginPeek. Reinvoking after recovery interval [" +
- RecoveryTimeSpan + "]", ex);
+ string message = "Exception executing DefaultMessageQueue.BeginPeek. Reinvoking after recovery interval [" +
+ RecoveryTimeSpan + "]";
+ LOG.LogError(ex, message);
Thread.Sleep(RecoveryTimeSpan);
StartPeeking();
}
@@ -230,7 +231,7 @@ namespace Spring.Messaging.Listener
bool listenerThreadWillCallStartPeek = false;
try
{
- LOG.Debug("Peek Completed called.");
+ LOG.LogDebug("Peek Completed called.");
MessageQueue.EndPeek(asyncResult);
@@ -243,7 +244,7 @@ namespace Spring.Messaging.Listener
numberOfListenersToSchedule = maxConcurrentListeners -
(activeListenerCount + scheduledListenerCount);
- LOG.Debug("Submitting " + numberOfListenersToSchedule + " listener work items");
+ LOG.LogDebug("Submitting " + numberOfListenersToSchedule + " listener work items");
#region Submit to thread pool up to max number of concurrent listeners
@@ -254,11 +255,11 @@ namespace Spring.Messaging.Listener
{
scheduledListenerCount++;
listenerThreadWillCallStartPeek = true;
- LOG.Debug("Queued ReceiveAndExecute listener # " + i);
+ LOG.LogDebug("Queued ReceiveAndExecute listener # " + i);
}
else
{
- LOG.Error("Could not submit ReceiveAndExecute work item for listener # " + i);
+ LOG.LogError("Could not submit ReceiveAndExecute work item for listener # " + i);
}
}
Monitor.PulseAll(activeListenerMonitor);
@@ -271,24 +272,23 @@ namespace Spring.Messaging.Listener
switch ((int) mex.MessageQueueErrorCode)
{
case -1073741536: // = 0xc0000120 "STATUS_CANCELLED".
- LOG.Info("Asynchronous Peek Thread sent STATUS_CANCELLED.");
+ LOG.LogInformation("Asynchronous Peek Thread sent STATUS_CANCELLED.");
break;
default:
- LOG.Error("MessageQueueException Peeking Message", mex);
+ LOG.LogError(mex, "MessageQueueException Peeking Message");
break;
}
}
catch (Exception e)
{
- LOG.Error("Exception Peeking Message", e);
+ LOG.LogError(e, "Exception Peeking Message");
}
finally
{
if (listenerThreadWillCallStartPeek == false && Running)
{
- LOG.Warn(
- "Could not queue any listeners onto the thread pool. Calling BeginPeek again after delay of " +
- RecoveryTimeSpan);
+ LOG.LogWarning("Could not queue any listeners onto the thread pool. Calling BeginPeek again after delay of " +
+ RecoveryTimeSpan);
Thread.Sleep(RecoveryTimeSpan);
StartPeeking();
}
@@ -314,7 +314,7 @@ namespace Spring.Messaging.Listener
try
{
- LOG.Debug("Executing ReceiveAndExecute");
+ LOG.LogDebug("Executing ReceiveAndExecute");
#region Increment Active Listener Count
@@ -322,8 +322,8 @@ namespace Spring.Messaging.Listener
{
activeListenerCount++;
scheduledListenerCount--;
- LOG.Debug("ActiveListenerCount = " + activeListenerCount);
- LOG.Debug("ScheduledListenerCount = " + scheduledListenerCount);
+ LOG.LogDebug("ActiveListenerCount = " + activeListenerCount);
+ LOG.LogDebug("ScheduledListenerCount = " + scheduledListenerCount);
Monitor.PulseAll(activeListenerMonitor);
}
@@ -338,45 +338,45 @@ namespace Spring.Messaging.Listener
if (ListenerTimeLimit == TimeSpan.Zero)
{
listenerTimeOut = true;
- LOG.Trace("No listener timelimit specified, exiting recieve loop after one iteration.");
+ LOG.LogTrace("No listener timelimit specified, exiting recieve loop after one iteration.");
}
else if (DateTime.Now >= expirationTime)
{
listenerTimeOut = true;
- LOG.Trace("Listener timeout, exiting receive loop.");
+ LOG.LogTrace("Listener timeout, exiting receive loop.");
}
else
{
- LOG.Trace("Continuing receive loop.");
+ LOG.LogTrace("Continuing receive loop.");
}
}
}
catch (Exception ex)
{
messageReceived = false;
- LOG.Error("Error receiving message from DefaultMessageQueue = [" + mq.Path + "]", ex);
+ string message = "Error receiving message from DefaultMessageQueue = [" + mq.Path + "]";
+ LOG.LogError(ex, message);
}
finally
{
- LOG.Debug("Exiting ReceiveAndExecute");
+ LOG.LogDebug("Exiting ReceiveAndExecute");
#region Decrementing Listener Count and call StartPeeking if last listener or there are still messages to process
lock (activeListenerMonitor)
{
activeListenerCount--;
- LOG.Debug("ActiveListenerCount = " + activeListenerCount);
- LOG.Trace("ListenerTimeout = " + listenerTimeOut + ", MessageRecieved = " + messageReceived);
+ LOG.LogDebug("ActiveListenerCount = " + activeListenerCount);
+ LOG.LogTrace("ListenerTimeout = " + listenerTimeOut + ", MessageRecieved = " + messageReceived);
if (activeListenerCount == 0)
{
- LOG.Debug("All processing threads ended - calling StartPeek again.");
+ LOG.LogDebug("All processing threads ended - calling StartPeek again.");
//last active worker thread needs to restart the peeking process
StartPeeking();
}
else if (listenerTimeOut && messageReceived)
{
- LOG.Debug(
- "Processing thread ended due to timeout and last recieve operation was successfull, calling StartPeek again.");
+ LOG.LogDebug("Processing thread ended due to timeout and last recieve operation was successfull, calling StartPeek again.");
StartPeeking();
}
Monitor.PulseAll(activeListenerMonitor);
@@ -408,7 +408,7 @@ namespace Spring.Messaging.Listener
{
while (activeListenerCount > 0)
{
- LOG.Debug("Waiting for termination of " + activeListenerCount + " listener threads.");
+ LOG.LogDebug("Waiting for termination of " + activeListenerCount + " listener threads.");
Monitor.Wait(activeListenerMonitor);
}
}
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/AbstractTransactionalMessageListenerContainer.cs b/src/Spring/Spring.Messaging/Messaging/Listener/AbstractTransactionalMessageListenerContainer.cs
index 960546c6..4bee73d7 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/AbstractTransactionalMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/AbstractTransactionalMessageListenerContainer.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using Spring.Data.Core;
using Spring.Messaging.Core;
using Spring.Transaction;
@@ -134,14 +135,14 @@ namespace Spring.Messaging.Listener
/// The exception.
protected void RollbackOnException(ITransactionStatus status, Exception ex)
{
- LOG.Debug("Initiating transaction rollback on listener exception", ex);
+ LOG.LogDebug(ex, "Initiating transaction rollback on listener exception");
try
{
PlatformTransactionManager.Rollback(status);
}
catch (Exception ex2)
{
- LOG.Error("Listener exception overridden by rollback error", ex2);
+ LOG.LogError(ex2, "Listener exception overridden by rollback error");
throw;
}
}
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/DistributedTxMessageListenerContainer.cs b/src/Spring/Spring.Messaging/Messaging/Listener/DistributedTxMessageListenerContainer.cs
index 485858d4..c709cf08 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/DistributedTxMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/DistributedTxMessageListenerContainer.cs
@@ -104,7 +104,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing DoReceiveAndExecuteUsingTxScopeTransactionManager");
+ LOG.LogDebug("Executing DoReceiveAndExecuteUsingTxScopeTransactionManager");
}
#endregion Logging
@@ -128,8 +128,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace(
- "MessageQueueErrorCode.IOTimeout: No message available to receive. May have been processed by another thread.");
+ LOG.LogTrace("MessageQueueErrorCode.IOTimeout: No message available to receive. May have been processed by another thread.");
}
#endregion
@@ -155,7 +154,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("Message recieved is null from Queue = [" + mq.Path + "]");
+ LOG.LogTrace("Message recieved is null from Queue = [" + mq.Path + "]");
}
#endregion
@@ -171,7 +170,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
+ LOG.LogDebug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
}
#endregion
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/MessageListenerAdapter.cs b/src/Spring/Spring.Messaging/Messaging/Listener/MessageListenerAdapter.cs
index 5a72235d..a7a133c4 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/MessageListenerAdapter.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/MessageListenerAdapter.cs
@@ -413,7 +413,7 @@ namespace Spring.Messaging.Listener
}
else
{
- logger.Debug("No result object given - no result to handle");
+ logger.LogDebug("No result object given - no result to handle");
}
}
@@ -506,8 +506,8 @@ namespace Spring.Messaging.Listener
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Listener method returned result [" + result +
- "] - generating response message for it");
+ logger.LogDebug("Listener method returned result [" + result +
+ "] - generating response message for it");
}
Message response = BuildMessage(result);
PostProcessResponse(request, response);
@@ -525,7 +525,7 @@ namespace Spring.Messaging.Listener
//Will send with appropriate transaction semantics
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Sending response message to path = [" + destination.Path + "]");
+ logger.LogDebug("Sending response message to path = [" + destination.Path + "]");
}
messageQueueTemplate.Send(destination, response);
}
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/NonTransactionalMessageListenerContainer.cs b/src/Spring/Spring.Messaging/Messaging/Listener/NonTransactionalMessageListenerContainer.cs
index 747165d3..7e97e189 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/NonTransactionalMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/NonTransactionalMessageListenerContainer.cs
@@ -90,7 +90,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("Receiving message with zero timeout for queue = [" + mq.Path + "]");
+ LOG.LogTrace("Receiving message with zero timeout for queue = [" + mq.Path + "]");
}
#endregion
@@ -107,8 +107,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace(
- "MessageQueueErrorCode.IOTimeout: No message available to receive. May have been processed by another thread.");
+ LOG.LogTrace("MessageQueueErrorCode.IOTimeout: No message available to receive. May have been processed by another thread.");
}
#endregion
@@ -123,8 +122,8 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Error))
{
- LOG.Error("Error receiving message from MessageQueue [" + mq.Path +
- "], closing queue and clearing connection cache.");
+ LOG.LogError("Error receiving message from MessageQueue [" + mq.Path +
+ "], closing queue and clearing connection cache.");
}
#endregion
@@ -144,7 +143,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("Message recieved is null from Queue = [" + mq.Path + "]");
+ LOG.LogTrace("Message recieved is null from Queue = [" + mq.Path + "]");
}
#endregion
@@ -158,7 +157,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
+ LOG.LogDebug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
}
#endregion
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/SendToQueueDistributedTransactionExceptionHandler.cs b/src/Spring/Spring.Messaging/Messaging/Listener/SendToQueueDistributedTransactionExceptionHandler.cs
index 63e905d8..d0b09c06 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/SendToQueueDistributedTransactionExceptionHandler.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/SendToQueueDistributedTransactionExceptionHandler.cs
@@ -71,7 +71,7 @@ namespace Spring.Messaging.Listener
messageStats = (MessageStats) messageMap[messageId];
if (messageStats.Count > MaxRetry)
{
- LOG.Warn("Message with id = [" + message.Id + "] detected as poison message.");
+ LOG.LogWarning("Message with id = [" + message.Id + "] detected as poison message.");
return true;
}
}
@@ -109,8 +109,8 @@ namespace Spring.Messaging.Listener
messageMap[messageId] = messageStats;
}
messageStats.Count++;
- LOG.Warn("Message Error Count = [" + messageStats.Count + "] for message id = [" + messageId +
- "]");
+ LOG.LogWarning("Message Error Count = [" + messageStats.Count + "] for message id = [" + messageId +
+ "]");
}
}
@@ -129,7 +129,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Information))
{
- LOG.Info("Sending message with id = [" + message.Id + "] to queue [" + mq.Path + "].");
+ LOG.LogInformation("Sending message with id = [" + message.Id + "] to queue [" + mq.Path + "].");
}
#endregion
@@ -142,8 +142,9 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Error))
{
- LOG.Error("Could not send message with id = [" + message.Id + "] to queue [" + mq.Path + "].", e);
- LOG.Error("Message will not be processed. Message Body = " + message.Body);
+ string message1 = "Could not send message with id = [" + message.Id + "] to queue [" + mq.Path + "].";
+ LOG.LogError(e, message1);
+ LOG.LogError("Message will not be processed. Message Body = " + message.Body);
}
#endregion
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/SendToQueueExceptionHandler.cs b/src/Spring/Spring.Messaging/Messaging/Listener/SendToQueueExceptionHandler.cs
index 4c74d2c0..94eae251 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/SendToQueueExceptionHandler.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/SendToQueueExceptionHandler.cs
@@ -100,17 +100,17 @@ namespace Spring.Messaging.Listener
messageMap[messageId] = messageStats;
}
messageStats.Count++;
- LOG.Warn("Message Error Count = [" + messageStats.Count + "] for message id = [" + messageId + "]");
+ LOG.LogWarning("Message Error Count = [" + messageStats.Count + "] for message id = [" + messageId + "]");
if (messageStats.Count > MaxRetry)
{
- LOG.Info("Maximum number of redelivery attempts exceeded for message id = [" + messageId + "]");
+ LOG.LogInformation("Maximum number of redelivery attempts exceeded for message id = [" + messageId + "]");
messageMap.Remove(messageId);
return SendMessageToQueue(message, messageQueueTransaction);
}
else
{
- LOG.Warn("Rolling back delivery of message id [" + messageId + "]");
+ LOG.LogWarning("Rolling back delivery of message id [" + messageId + "]");
return TransactionAction.Rollback;
}
}
@@ -158,7 +158,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Information))
{
- LOG.Info("Sending message with id = [" + message.Id + "] to queue [" + mq.Path + "].");
+ LOG.LogInformation("Sending message with id = [" + message.Id + "] to queue [" + mq.Path + "].");
}
#endregion
@@ -172,8 +172,9 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Error))
{
- LOG.Error("Could not send message with id = [" + message.Id + "] to queue [" + mq.Path + "].",e);
- LOG.Error("Message will not be processed. Message Body = " + message.Body);
+ string message1 = "Could not send message with id = [" + message.Id + "] to queue [" + mq.Path + "].";
+ LOG.LogError(e, message1);
+ LOG.LogError("Message will not be processed. Message Body = " + message.Body);
}
#endregion
diff --git a/src/Spring/Spring.Messaging/Messaging/Listener/TransactionalMessageListenerContainer.cs b/src/Spring/Spring.Messaging/Messaging/Listener/TransactionalMessageListenerContainer.cs
index 2f257a0c..a77de83c 100644
--- a/src/Spring/Spring.Messaging/Messaging/Listener/TransactionalMessageListenerContainer.cs
+++ b/src/Spring/Spring.Messaging/Messaging/Listener/TransactionalMessageListenerContainer.cs
@@ -297,7 +297,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing DoRecieveAndExecuteUsingMessageQueueTransactionManager");
+ LOG.LogDebug("Executing DoRecieveAndExecuteUsingMessageQueueTransactionManager");
}
#endregion Logging
@@ -317,7 +317,7 @@ namespace Spring.Messaging.Listener
//expected to occur occasionally
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("IOTimeout: Message to receive was already processed by another thread.");
+ LOG.LogTrace("IOTimeout: Message to receive was already processed by another thread.");
}
status.SetRollbackOnly();
return false; // no more peeking unless this is the last listener thread
@@ -330,8 +330,8 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Error))
{
- LOG.Error("Error receiving message from DefaultMessageQueue [" + mq.Path +
- "], closing queue and clearing connection cache.");
+ LOG.LogError("Error receiving message from DefaultMessageQueue [" + mq.Path +
+ "], closing queue and clearing connection cache.");
}
#endregion
@@ -353,7 +353,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("Message recieved is null from Queue = [" + mq.Path + "]");
+ LOG.LogTrace("Message recieved is null from Queue = [" + mq.Path + "]");
}
#endregion
@@ -368,7 +368,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
+ LOG.LogDebug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
}
#endregion
@@ -380,7 +380,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("MessageListener executed");
+ LOG.LogTrace("MessageListener executed");
}
#endregion
@@ -397,9 +397,8 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug(
- "Exception handler's TransactionAction has rolled back MessageQueueTransaction for queue [" +
- mq.Path + "]");
+ LOG.LogDebug("Exception handler's TransactionAction has rolled back MessageQueueTransaction for queue [" +
+ mq.Path + "]");
}
#endregion
@@ -409,7 +408,7 @@ namespace Spring.Messaging.Listener
}
else
{
- LOG.Info("Committing MessageQueueTransaction due to explicit commit request by exception handler.");
+ LOG.LogInformation("Committing MessageQueueTransaction due to explicit commit request by exception handler.");
}
}
finally
@@ -432,7 +431,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Executing DoRecieveAndExecuteUsingResourceTransactionManagerWithTxQueue");
+ LOG.LogDebug("Executing DoRecieveAndExecuteUsingResourceTransactionManagerWithTxQueue");
}
#endregion Logging
@@ -445,7 +444,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("Started MessageQueueTransaction for queue = [" + mq.Path + "]");
+ LOG.LogTrace("Started MessageQueueTransaction for queue = [" + mq.Path + "]");
}
#endregion
@@ -460,7 +459,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("Receiving message with zero timeout for queue = [" + mq.Path + "]");
+ LOG.LogTrace("Receiving message with zero timeout for queue = [" + mq.Path + "]");
}
#endregion
@@ -477,8 +476,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace(
- "MessageQueueErrorCode.IOTimeout: No message available to receive. May have been processed by another thread.");
+ LOG.LogTrace("MessageQueueErrorCode.IOTimeout: No message available to receive. May have been processed by another thread.");
}
#endregion
@@ -494,8 +492,8 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Error))
{
- LOG.Error("Error receiving message from DefaultMessageQueue [" + mq.Path +
- "], closing queue and clearing connection cache.");
+ LOG.LogError("Error receiving message from DefaultMessageQueue [" + mq.Path +
+ "], closing queue and clearing connection cache.");
}
#endregion
@@ -517,7 +515,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("Message recieved is null from Queue = [" + mq.Path + "]");
+ LOG.LogTrace("Message recieved is null from Queue = [" + mq.Path + "]");
}
#endregion
@@ -532,7 +530,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
+ LOG.LogDebug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
}
#endregion
@@ -552,7 +550,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("MessageListener executed");
+ LOG.LogTrace("MessageListener executed");
}
#endregion
@@ -563,7 +561,7 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Trace))
{
- LOG.Trace("Committed MessageQueueTransaction for queue [" + mq.Path + "]");
+ LOG.LogTrace("Committed MessageQueueTransaction for queue [" + mq.Path + "]");
}
#endregion
@@ -580,9 +578,8 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug(
- "Exception handler's TransactionAction has rolled back MessageQueueTransaction for queue [" +
- mq.Path + "]");
+ LOG.LogDebug("Exception handler's TransactionAction has rolled back MessageQueueTransaction for queue [" +
+ mq.Path + "]");
}
#endregion
@@ -596,9 +593,8 @@ namespace Spring.Messaging.Listener
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug(
- "Exception handler's TransactionAction has committed MessageQueueTransaction for queue [" +
- mq.Path + "]");
+ LOG.LogDebug("Exception handler's TransactionAction has committed MessageQueueTransaction for queue [" +
+ mq.Path + "]");
}
#endregion
@@ -639,19 +635,19 @@ namespace Spring.Messaging.Listener
{
// Regular case: failed while active.
// Log at error level.
- LOG.Error("Execution of message listener failed", e);
+ LOG.LogError(e, "Execution of message listener failed");
}
else
{
// Rare case: listener thread failed after container shutdown.
// Log at debug level, to avoid spamming the shutdown log.
- LOG.Debug("Listener exception after container shutdown", e);
+ LOG.LogDebug(e, "Listener exception after container shutdown");
}
return transactionAction;
}
catch (Exception ex)
{
- LOG.Error("Exception invoking MessageTransactionExceptionHandler. Rolling back transaction.", ex);
+ LOG.LogError(ex, "Exception invoking MessageTransactionExceptionHandler. Rolling back transaction.");
return TransactionAction.Rollback;
}
}
@@ -676,7 +672,7 @@ namespace Spring.Messaging.Listener
}
else
{
- LOG.Warn("No MessageTransactionExceptionHandler defined. Defaulting to TransactionAction.Rollback.");
+ LOG.LogWarning("No MessageTransactionExceptionHandler defined. Defaulting to TransactionAction.Rollback.");
return TransactionAction.Rollback;
}
}
diff --git a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/LocalTaskExecutorThreadPool.cs b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/LocalTaskExecutorThreadPool.cs
index 8091f4e8..5d747d3b 100644
--- a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/LocalTaskExecutorThreadPool.cs
+++ b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/LocalTaskExecutorThreadPool.cs
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+using Microsoft.Extensions.Logging;
using Quartz;
using Quartz.Spi;
@@ -89,7 +90,7 @@ namespace Spring.Scheduling.Quartz
}
catch (TaskRejectedException ex)
{
- Logger.Error("Task has been rejected by TaskExecutor", ex);
+ Logger.LogError(ex, "Task has been rejected by TaskExecutor");
return false;
}
}
diff --git a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/MethodInvokingJob.cs b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/MethodInvokingJob.cs
index 628413b9..505d55ed 100644
--- a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/MethodInvokingJob.cs
+++ b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/MethodInvokingJob.cs
@@ -15,6 +15,7 @@
*/
using System.Reflection;
+using Microsoft.Extensions.Logging;
using Quartz;
using Spring.Objects.Support;
@@ -60,7 +61,7 @@ namespace Spring.Scheduling.Quartz
}
catch (TargetInvocationException ex)
{
- logger.Error(errorMessage, ex.GetBaseException());
+ logger.LogError(ex.GetBaseException(), errorMessage);
if (ex.GetBaseException() is JobExecutionException)
{
// -> JobExecutionException, to be logged at info level by Quartz
diff --git a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/MethodInvokingRunnable.cs b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/MethodInvokingRunnable.cs
index 5a5a42cd..2b20be6e 100644
--- a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/MethodInvokingRunnable.cs
+++ b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/MethodInvokingRunnable.cs
@@ -15,6 +15,7 @@
*/
using System.Reflection;
+using Microsoft.Extensions.Logging;
using Spring.Objects.Factory;
using Spring.Objects.Support;
@@ -103,12 +104,12 @@ namespace Spring.Scheduling.Quartz
}
catch (TargetInvocationException ex)
{
- logger.Error(InvocationFailureMessage, ex);
+ logger.LogError(ex, InvocationFailureMessage);
// Do not throw exception, else the main loop of the Timer will stop!
}
catch (Exception ex)
{
- logger.Error(InvocationFailureMessage, ex);
+ logger.LogError(ex, InvocationFailureMessage);
// Do not throw exception, else the main loop of the Timer will stop!
}
diff --git a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/SchedulerAccessor.cs b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/SchedulerAccessor.cs
index 62fe2cd6..fc476ed0 100644
--- a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/SchedulerAccessor.cs
+++ b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/SchedulerAccessor.cs
@@ -15,6 +15,7 @@
*/
using System.Collections;
+using Microsoft.Extensions.Logging;
using Quartz;
using Quartz.Simpl;
using Quartz.Xml;
@@ -305,7 +306,7 @@ namespace Spring.Scheduling.Quartz
}
catch (TransactionException)
{
- logger.Error("Job registration exception overridden by rollback exception", ex);
+ logger.LogError(ex, "Job registration exception overridden by rollback exception");
throw;
}
}
@@ -375,7 +376,7 @@ namespace Spring.Scheduling.Quartz
{
if (logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
{
- logger.Debug($"Unexpectedly found existing trigger, assumably due to cluster race condition: {ex.Message} - can safely be ignored");
+ logger.LogDebug($"Unexpectedly found existing trigger, assumably due to cluster race condition: {ex.Message} - can safely be ignored");
}
if (overwriteExistingJobs)
diff --git a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/SchedulerFactoryObject.cs b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/SchedulerFactoryObject.cs
index c1005bbe..e0be9794 100644
--- a/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/SchedulerFactoryObject.cs
+++ b/src/Spring/Spring.Scheduling.Quartz3/Scheduling/Quartz/SchedulerFactoryObject.cs
@@ -454,7 +454,7 @@ namespace Spring.Scheduling.Quartz
///
public virtual void Dispose()
{
- Logger.Info("Shutting down Quartz Scheduler");
+ Logger.LogInformation("Shutting down Quartz Scheduler");
scheduler.Shutdown(waitForJobsToCompleteOnShutdown).ConfigureAwait(false).GetAwaiter().GetResult();
}
@@ -631,7 +631,7 @@ namespace Spring.Scheduling.Quartz
{
if (Logger.IsEnabled(LogLevel.Information))
{
- Logger.Info("Loading Quartz config from [" + configLocation + "]");
+ Logger.LogInformation("Loading Quartz config from [" + configLocation + "]");
}
using (StreamReader sr = new StreamReader(configLocation.InputStream))
@@ -761,7 +761,7 @@ namespace Spring.Scheduling.Quartz
{
if (startDelay.TotalSeconds <= 0)
{
- Logger.Info("Starting Quartz Scheduler now");
+ Logger.LogInformation("Starting Quartz Scheduler now");
await sched.Start().ConfigureAwait(false);
}
else
diff --git a/src/Spring/Spring.Services/Remoting/CaoExporter.cs b/src/Spring/Spring.Services/Remoting/CaoExporter.cs
index 2487f0b6..70ee6037 100644
--- a/src/Spring/Spring.Services/Remoting/CaoExporter.cs
+++ b/src/Spring/Spring.Services/Remoting/CaoExporter.cs
@@ -185,7 +185,7 @@ namespace Spring.Remoting
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug(String.Format("Target '{0}' registered.", targetName));
+ LOG.LogDebug(String.Format("Target '{0}' registered.", targetName));
}
#endregion
diff --git a/src/Spring/Spring.Services/Remoting/CaoFactoryObject.cs b/src/Spring/Spring.Services/Remoting/CaoFactoryObject.cs
index d3f28483..384cb8db 100644
--- a/src/Spring/Spring.Services/Remoting/CaoFactoryObject.cs
+++ b/src/Spring/Spring.Services/Remoting/CaoFactoryObject.cs
@@ -137,7 +137,7 @@ namespace Spring.Remoting
string url = serviceUrl.TrimEnd('/') + '/' + remoteTargetName;
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug("Accessing CAO object of type ICaoRemoteFactory object at url = [" + url + "]");
+ LOG.LogDebug("Accessing CAO object of type ICaoRemoteFactory object at url = [" + url + "]");
}
ICaoRemoteFactory remoteFactory = (ICaoRemoteFactory) Activator.GetObject(typeof(ICaoRemoteFactory), url);
diff --git a/src/Spring/Spring.Services/Remoting/RemotingConfigurer.cs b/src/Spring/Spring.Services/Remoting/RemotingConfigurer.cs
index 06ddf1d9..47328394 100644
--- a/src/Spring/Spring.Services/Remoting/RemotingConfigurer.cs
+++ b/src/Spring/Spring.Services/Remoting/RemotingConfigurer.cs
@@ -124,11 +124,11 @@ namespace Spring.Remoting
{
if (filename == null)
{
- log.Debug("Default remoting infrastructure loaded.");
+ log.LogDebug("Default remoting infrastructure loaded.");
}
else
{
- log.Debug(String.Format("Remoting infrastructure configured using file '{0}'.", filename));
+ log.LogDebug(String.Format("Remoting infrastructure configured using file '{0}'.", filename));
}
}
diff --git a/src/Spring/Spring.Services/Remoting/SaoExporter.cs b/src/Spring/Spring.Services/Remoting/SaoExporter.cs
index 4950c3ec..6d9ad8c0 100644
--- a/src/Spring/Spring.Services/Remoting/SaoExporter.cs
+++ b/src/Spring/Spring.Services/Remoting/SaoExporter.cs
@@ -279,7 +279,7 @@ namespace Spring.Remoting
if (LOG.IsEnabled(LogLevel.Debug))
{
- LOG.Debug( String.Format( "Target '{0}' exported as '{1}'.", targetName, objectUri ) );
+ LOG.LogDebug(String.Format( "Target '{0}' exported as '{1}'.", targetName, objectUri ));
}
#endregion
diff --git a/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactoryObject.cs b/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactoryObject.cs
index e095b624..47a10fce 100644
--- a/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactoryObject.cs
+++ b/src/Spring/Spring.Services/ServiceModel/Activation/ServiceHostFactoryObject.cs
@@ -185,7 +185,7 @@ namespace Spring.ServiceModel.Activation
if (LOG.IsEnabled(LogLevel.Information))
{
- LOG.Info(String.Format("The service '{0}' is ready and can now be accessed.", TargetName));
+ LOG.LogInformation(String.Format("The service '{0}' is ready and can now be accessed.", TargetName));
}
#endregion
diff --git a/src/Spring/Spring.Services/ServiceModel/ChannelFactoryObject.cs b/src/Spring/Spring.Services/ServiceModel/ChannelFactoryObject.cs
index 72187876..6ca32ae0 100644
--- a/src/Spring/Spring.Services/ServiceModel/ChannelFactoryObject.cs
+++ b/src/Spring/Spring.Services/ServiceModel/ChannelFactoryObject.cs
@@ -77,7 +77,7 @@ namespace Spring.ServiceModel
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug(String.Format(
+ Log.LogDebug(String.Format(
"Creating channel of type '{0}' for the specified endpoint '{1}'...",
typeof(T).FullName, this._endpointConfigurationName));
}
diff --git a/src/Spring/Spring.Services/Web/Services/WebServiceProxyFactory.cs b/src/Spring/Spring.Services/Web/Services/WebServiceProxyFactory.cs
index cbb2e13b..c0f012dd 100644
--- a/src/Spring/Spring.Services/Web/Services/WebServiceProxyFactory.cs
+++ b/src/Spring/Spring.Services/Web/Services/WebServiceProxyFactory.cs
@@ -328,15 +328,13 @@ namespace Spring.Web.Services
{
if (ServiceUri != null)
{
- LOG.Debug(
- String.Format("Generated client proxy type [{0}] for web service [{1}]", wrapper.FullName,
- ServiceUri.Description));
+ LOG.LogDebug(String.Format("Generated client proxy type [{0}] for web service [{1}]", wrapper.FullName,
+ ServiceUri.Description));
}
else if (ProxyType != null)
{
- LOG.Debug(
- String.Format("Generated client proxy type [{0}] for web service based on provided proxy type [{1}]", wrapper.FullName,
- ProxyType.FullName));
+ LOG.LogDebug(String.Format("Generated client proxy type [{0}] for web service based on provided proxy type [{1}]", wrapper.FullName,
+ ProxyType.FullName));
}
}
@@ -738,7 +736,7 @@ namespace Spring.Web.Services
if (LOG.IsEnabled(LogLevel.Information))
{
- LOG.Info(String.Format("The binding '{0}', found in the WSDL document located at '{1}', will be use.", binding.Name, this.serviceUri.Description));
+ LOG.LogInformation(String.Format("The binding '{0}', found in the WSDL document located at '{1}', will be use.", binding.Name, this.serviceUri.Description));
}
#endregion
diff --git a/src/Spring/Spring.Template.Velocity.Castle/Template/Velocity/SpringResourceLoader.cs b/src/Spring/Spring.Template.Velocity.Castle/Template/Velocity/SpringResourceLoader.cs
index 093ba84d..d24369e9 100644
--- a/src/Spring/Spring.Template.Velocity.Castle/Template/Velocity/SpringResourceLoader.cs
+++ b/src/Spring/Spring.Template.Velocity.Castle/Template/Velocity/SpringResourceLoader.cs
@@ -113,7 +113,7 @@ namespace Spring.Template.Velocity
}
if (log.IsEnabled(LogLevel.Information))
{
- log.Info(string.Format("SpringResourceLoader for Velocity: using resource loader [{0}] and resource loader paths {1}", resourceLoader, resourceLoaderPaths));
+ log.LogInformation(string.Format("SpringResourceLoader for Velocity: using resource loader [{0}] and resource loader paths {1}", resourceLoader, resourceLoaderPaths));
}
}
@@ -126,7 +126,7 @@ namespace Spring.Template.Velocity
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Looking for Velocity resource with name [{0}]", source));
+ log.LogDebug(string.Format("Looking for Velocity resource with name [{0}]", source));
}
foreach (string resourceLoaderPath in resourceLoaderPaths)
@@ -140,7 +140,8 @@ namespace Spring.Template.Velocity
{
if (log.IsEnabled(LogLevel.Error))
{
- log.Error(string.Format("Could not find Velocity resource: {0}", resource), ex);
+ string message = string.Format("Could not find Velocity resource: {0}", resource);
+ log.LogError(ex, message);
}
}
}
diff --git a/src/Spring/Spring.Template.Velocity/Template/Velocity/CommonsLoggingLogSystem.cs b/src/Spring/Spring.Template.Velocity/Template/Velocity/CommonsLoggingLogSystem.cs
index 24daa3e3..64c12319 100644
--- a/src/Spring/Spring.Template.Velocity/Template/Velocity/CommonsLoggingLogSystem.cs
+++ b/src/Spring/Spring.Template.Velocity/Template/Velocity/CommonsLoggingLogSystem.cs
@@ -18,6 +18,7 @@
#endregion
+using Microsoft.Extensions.Logging;
using NVelocity.Runtime;
using NVelocity.Runtime.Log;
using LogLevel=NVelocity.Runtime.Log.LogLevel;
@@ -52,16 +53,16 @@ namespace Spring.Template.Velocity
{
switch (level) {
case LogLevel.Error:
- log.Error(message);
+ log.LogError(message);
break;
case LogLevel.Warn:
- log.Warn(message);
+ log.LogWarning(message);
break;
case LogLevel.Info:
- log.Info(message);
+ log.LogInformation(message);
break;
case LogLevel.Debug:
- log.Debug(message);
+ log.LogDebug(message);
break;
}
}
diff --git a/src/Spring/Spring.Template.Velocity/Template/Velocity/SpringResourceLoader.cs b/src/Spring/Spring.Template.Velocity/Template/Velocity/SpringResourceLoader.cs
index ee3d8488..5da2ca68 100644
--- a/src/Spring/Spring.Template.Velocity/Template/Velocity/SpringResourceLoader.cs
+++ b/src/Spring/Spring.Template.Velocity/Template/Velocity/SpringResourceLoader.cs
@@ -105,7 +105,7 @@ namespace Spring.Template.Velocity {
}
}
if (log.IsEnabled(LogLevel.Information)) {
- log.Info(string.Format("SpringResourceLoader for Velocity: using resource loader [{0}] and resource loader paths {1}", resourceLoader, resourceLoaderPaths));
+ log.LogInformation(string.Format("SpringResourceLoader for Velocity: using resource loader [{0}] and resource loader paths {1}", resourceLoader, resourceLoaderPaths));
}
}
@@ -116,7 +116,7 @@ namespace Spring.Template.Velocity {
/// a System.IO.Stream representation of the resource
public override Stream GetResourceStream(string source) {
if (log.IsEnabled(LogLevel.Debug)) {
- log.Debug(string.Format("Looking for Velocity resource with name [{0}]", source));
+ log.LogDebug(string.Format("Looking for Velocity resource with name [{0}]", source));
}
foreach (string resourceLoaderPath in resourceLoaderPaths){
@@ -124,8 +124,10 @@ namespace Spring.Template.Velocity {
try {
return resource.InputStream;
} catch (IOException ex) {
- if (log.IsEnabled(LogLevel.Error)) {
- log.Error(string.Format("Could not find Velocity resource: {0}", resource), ex);
+ if (log.IsEnabled(LogLevel.Error))
+ {
+ string message = string.Format("Could not find Velocity resource: {0}", resource);
+ log.LogError(ex, message);
}
}
}
diff --git a/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactory.cs b/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactory.cs
index 9a4e6088..20dfb291 100644
--- a/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactory.cs
+++ b/src/Spring/Spring.Template.Velocity/Template/Velocity/VelocityEngineFactory.cs
@@ -205,7 +205,7 @@ namespace Spring.Template.Velocity {
// Load config file if set.
if (configLocation != null) {
if (log.IsEnabled(LogLevel.Information)) {
- log.Info(string.Format("Loading Velocity config from [{0}]", configLocation));
+ log.LogInformation(string.Format("Loading Velocity config from [{0}]", configLocation));
}
FillProperties(extendedProperties, configLocation, false);
}
@@ -304,9 +304,11 @@ namespace Spring.Template.Velocity {
extendedProperties.SetProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,
StringUtils.CollectionToCommaDelimitedString(resolvedPaths));
} catch (IOException ex) {
- if (log.IsEnabled(LogLevel.Debug)) {
- log.Error(string.Format("Cannot resolve resource loader path [{0}] to [File]: using SpringResourceLoader",
- StringUtils.CollectionToCommaDelimitedString(resolvedPaths)), ex);
+ if (log.IsEnabled(LogLevel.Debug))
+ {
+ string message = string.Format("Cannot resolve resource loader path [{0}] to [File]: using SpringResourceLoader",
+ StringUtils.CollectionToCommaDelimitedString(resolvedPaths));
+ log.LogError(ex, message);
}
InitSpringResourceLoader(velocityEngine, extendedProperties, StringUtils.CollectionToCommaDelimitedString(paths));
@@ -314,7 +316,7 @@ namespace Spring.Template.Velocity {
} else {
// Always load via SpringResourceLoader (without hot detection of template changes).
if (log.IsEnabled(LogLevel.Debug)) {
- log.Debug("File system access not preferred: using SpringResourceLoader");
+ log.LogDebug("File system access not preferred: using SpringResourceLoader");
}
InitSpringResourceLoader(velocityEngine, extendedProperties, StringUtils.CollectionToCommaDelimitedString(paths));
}
diff --git a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractDependencyInjectionSpringContextTests.cs b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractDependencyInjectionSpringContextTests.cs
index 909f7a0b..c391d551 100644
--- a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractDependencyInjectionSpringContextTests.cs
+++ b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractDependencyInjectionSpringContextTests.cs
@@ -171,7 +171,7 @@ namespace Spring.Testing.Microsoft
}
catch (Exception ex)
{
- logger.Error("Setup error", ex);
+ logger.LogError(ex, "Setup error");
throw;
}
}
@@ -237,7 +237,7 @@ namespace Spring.Testing.Microsoft
type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance);
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Found " + fields.Length + " fields on " + type);
+ logger.LogDebug("Found " + fields.Length + " fields on " + type);
}
for (int i = 0; i < fields.Length; i++)
@@ -245,7 +245,7 @@ namespace Spring.Testing.Microsoft
FieldInfo field = fields[i];
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Candidate field: " + field);
+ logger.LogDebug("Candidate field: " + field);
}
if (IsProtectedInstanceField(field))
{
@@ -255,14 +255,14 @@ namespace Spring.Testing.Microsoft
managedVarNames.Add(field.Name);
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Added managed variable '" + field.Name + "'");
+ logger.LogDebug("Added managed variable '" + field.Name + "'");
}
}
else
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Rejected managed variable '" + field.Name + "'");
+ logger.LogDebug("Rejected managed variable '" + field.Name + "'");
}
}
}
@@ -297,14 +297,14 @@ namespace Spring.Testing.Microsoft
field.SetValue(this, obj);
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Populated field: " + field);
+ logger.LogDebug("Populated field: " + field);
}
}
else
{
if (logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("No field with name '" + fieldName + "'");
+ logger.LogWarning("No field with name '" + fieldName + "'");
}
}
}
@@ -312,7 +312,7 @@ namespace Spring.Testing.Microsoft
{
if (logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("No object definition with name '" + fieldName + "'");
+ logger.LogWarning("No object definition with name '" + fieldName + "'");
}
}
}
@@ -345,7 +345,7 @@ namespace Spring.Testing.Microsoft
}
catch (Exception ex)
{
- logger.Error("OnTearDown error", ex);
+ logger.LogError(ex, "OnTearDown error");
}
}
diff --git a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractSpringContextTests.cs b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractSpringContextTests.cs
index 875c9951..327e97f6 100644
--- a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractSpringContextTests.cs
+++ b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractSpringContextTests.cs
@@ -215,7 +215,7 @@ namespace Spring.Testing.Microsoft
{
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Loading config for: " + StringUtils.CollectionToCommaDelimitedString(locations));
+ logger.LogInformation("Loading config for: " + StringUtils.CollectionToCommaDelimitedString(locations));
}
return new XmlApplicationContext(locations);
}
diff --git a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalDbProviderSpringContextTests.cs b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalDbProviderSpringContextTests.cs
index 2e082534..9394cbde 100644
--- a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalDbProviderSpringContextTests.cs
+++ b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalDbProviderSpringContextTests.cs
@@ -106,7 +106,7 @@ namespace Spring.Testing.Microsoft
int rowCount = this.adoTemplate.ExecuteNonQuery(CommandType.Text, "DELETE FROM " + names[i]);
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Deleted " + rowCount + " rows from table " + names[i]);
+ logger.LogInformation("Deleted " + rowCount + " rows from table " + names[i]);
}
}
this.zappedTables = true;
diff --git a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalSpringContextTests.cs b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalSpringContextTests.cs
index 570b1d45..932a558c 100644
--- a/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalSpringContextTests.cs
+++ b/src/Spring/Spring.Testing.Microsoft/Testing/Microsoft/AbstractTransactionalSpringContextTests.cs
@@ -171,11 +171,11 @@ namespace Spring.Testing.Microsoft
if (this.transactionManager == null)
{
- logger.Info("No transaction manager set: test will NOT run within a transaction");
+ logger.LogInformation("No transaction manager set: test will NOT run within a transaction");
}
else if (this.transactionDefinition == null)
{
- logger.Info("No transaction definition set: test will NOT run within a transaction");
+ logger.LogInformation("No transaction definition set: test will NOT run within a transaction");
}
else
{
@@ -271,12 +271,12 @@ namespace Spring.Testing.Microsoft
if (!this.complete)
{
this.transactionManager.Rollback(this.transactionStatus);
- logger.Info("Rolled back transaction after test execution");
+ logger.LogInformation("Rolled back transaction after test execution");
}
else
{
this.transactionManager.Commit(this.transactionStatus);
- logger.Info("Committed transaction after test execution");
+ logger.LogInformation("Committed transaction after test execution");
}
}
finally
@@ -307,8 +307,8 @@ namespace Spring.Testing.Microsoft
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Began transaction (" + this.transactionsStarted + "): transaction manager [" +
- this.transactionManager + "]; default rollback = " + this.defaultRollback);
+ logger.LogInformation("Began transaction (" + this.transactionsStarted + "): transaction manager [" +
+ this.transactionManager + "]; default rollback = " + this.defaultRollback);
}
}
}
diff --git a/src/Spring/Spring.Testing.NUnit/Testing/Ado/SimpleAdoTestUtils.cs b/src/Spring/Spring.Testing.NUnit/Testing/Ado/SimpleAdoTestUtils.cs
index d45af0d8..b37ab38f 100644
--- a/src/Spring/Spring.Testing.NUnit/Testing/Ado/SimpleAdoTestUtils.cs
+++ b/src/Spring/Spring.Testing.NUnit/Testing/Ado/SimpleAdoTestUtils.cs
@@ -21,8 +21,7 @@
using System.Data;
using System.Reflection;
using System.Text.RegularExpressions;
-
-
+using Microsoft.Extensions.Logging;
using Spring.Core.IO;
using Spring.Dao;
using Spring.Data;
@@ -173,7 +172,9 @@ namespace Spring.Testing.Ado
{
throw;
}
- Log.Warn(string.Format("SQL statement failed:{0}", statement), dae);
+
+ string message = string.Format("SQL statement failed:{0}", statement);
+ Log.LogWarning(dae, message);
}
}
}
diff --git a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractDependencyInjectionSpringContextTests.cs b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractDependencyInjectionSpringContextTests.cs
index fccce6f0..34222ddb 100644
--- a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractDependencyInjectionSpringContextTests.cs
+++ b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractDependencyInjectionSpringContextTests.cs
@@ -171,7 +171,7 @@ namespace Spring.Testing.NUnit
}
catch (Exception ex)
{
- logger.Error("Setup error", ex);
+ logger.LogError(ex, "Setup error");
throw;
}
}
@@ -237,7 +237,7 @@ namespace Spring.Testing.NUnit
type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance);
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Found " + fields.Length + " fields on " + type);
+ logger.LogDebug("Found " + fields.Length + " fields on " + type);
}
for (int i = 0; i < fields.Length; i++)
@@ -245,7 +245,7 @@ namespace Spring.Testing.NUnit
FieldInfo field = fields[i];
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Candidate field: " + field);
+ logger.LogDebug("Candidate field: " + field);
}
if (IsProtectedInstanceField(field))
{
@@ -255,14 +255,14 @@ namespace Spring.Testing.NUnit
managedVarNames.Add(field.Name);
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Added managed variable '" + field.Name + "'");
+ logger.LogDebug("Added managed variable '" + field.Name + "'");
}
}
else
{
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Rejected managed variable '" + field.Name + "'");
+ logger.LogDebug("Rejected managed variable '" + field.Name + "'");
}
}
}
@@ -297,14 +297,14 @@ namespace Spring.Testing.NUnit
field.SetValue(this, obj);
if (logger.IsEnabled(LogLevel.Debug))
{
- logger.Debug("Populated field: " + field);
+ logger.LogDebug("Populated field: " + field);
}
}
else
{
if (logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("No field with name '" + fieldName + "'");
+ logger.LogWarning("No field with name '" + fieldName + "'");
}
}
}
@@ -312,7 +312,7 @@ namespace Spring.Testing.NUnit
{
if (logger.IsEnabled(LogLevel.Warning))
{
- logger.Warn("No object definition with name '" + fieldName + "'");
+ logger.LogWarning("No object definition with name '" + fieldName + "'");
}
}
}
@@ -346,7 +346,7 @@ namespace Spring.Testing.NUnit
}
catch (Exception ex)
{
- logger.Error("OnTearDown error", ex);
+ logger.LogError(ex, "OnTearDown error");
throw;
}
}
diff --git a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractSpringContextTests.cs b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractSpringContextTests.cs
index 154e1f8c..684bba64 100644
--- a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractSpringContextTests.cs
+++ b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractSpringContextTests.cs
@@ -227,7 +227,7 @@ namespace Spring.Testing.NUnit
{
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Loading config for: " + StringUtils.CollectionToCommaDelimitedString(locations));
+ logger.LogInformation("Loading config for: " + StringUtils.CollectionToCommaDelimitedString(locations));
}
return new XmlApplicationContext(locations);
}
diff --git a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalDbProviderSpringContextTests.cs b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalDbProviderSpringContextTests.cs
index 6ac329be..e012be79 100644
--- a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalDbProviderSpringContextTests.cs
+++ b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalDbProviderSpringContextTests.cs
@@ -87,7 +87,7 @@ namespace Spring.Testing.NUnit
int rowCount = this.adoTemplate.ExecuteNonQuery(CommandType.Text, "DELETE FROM " + names[i]);
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Deleted " + rowCount + " rows from table " + names[i]);
+ logger.LogInformation("Deleted " + rowCount + " rows from table " + names[i]);
}
}
this.zappedTables = true;
diff --git a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalSpringContextTests.cs b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalSpringContextTests.cs
index 13b0003d..18ac60ec 100644
--- a/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalSpringContextTests.cs
+++ b/src/Spring/Spring.Testing.NUnit/Testing/NUnit/AbstractTransactionalSpringContextTests.cs
@@ -143,11 +143,11 @@ namespace Spring.Testing.NUnit
if (this.transactionManager == null)
{
- logger.Info("No transaction manager set: test will NOT run within a transaction");
+ logger.LogInformation("No transaction manager set: test will NOT run within a transaction");
}
else if (this.transactionDefinition == null)
{
- logger.Info("No transaction definition set: test will NOT run within a transaction");
+ logger.LogInformation("No transaction definition set: test will NOT run within a transaction");
}
else
{
@@ -243,12 +243,12 @@ namespace Spring.Testing.NUnit
if (!this.complete)
{
this.transactionManager.Rollback(this.transactionStatus);
- logger.Info("Rolled back transaction after test execution");
+ logger.LogInformation("Rolled back transaction after test execution");
}
else
{
this.transactionManager.Commit(this.transactionStatus);
- logger.Info("Committed transaction after test execution");
+ logger.LogInformation("Committed transaction after test execution");
}
}
finally
@@ -279,8 +279,8 @@ namespace Spring.Testing.NUnit
if (logger.IsEnabled(LogLevel.Information))
{
- logger.Info("Began transaction (" + this.transactionsStarted + "): transaction manager [" +
- this.transactionManager + "]; default rollback = " + this.defaultRollback);
+ logger.LogInformation("Began transaction (" + this.transactionsStarted + "): transaction manager [" +
+ this.transactionManager + "]; default rollback = " + this.defaultRollback);
}
}
}
diff --git a/src/Spring/Spring.Web.Conversation.NHibernate5/Data/NHibernate/Support/SessionPerConversationScope.cs b/src/Spring/Spring.Web.Conversation.NHibernate5/Data/NHibernate/Support/SessionPerConversationScope.cs
index 842f58ae..58957945 100644
--- a/src/Spring/Spring.Web.Conversation.NHibernate5/Data/NHibernate/Support/SessionPerConversationScope.cs
+++ b/src/Spring/Spring.Web.Conversation.NHibernate5/Data/NHibernate/Support/SessionPerConversationScope.cs
@@ -186,7 +186,7 @@ namespace Spring.Data.NHibernate.Support
{
if (isDebugEnabled)
{
- log.Debug($"SessionPerConversationScope is already open for this conversation: Id:'{activeConversation.Id}'.");
+ log.LogDebug($"SessionPerConversationScope is already open for this conversation: Id:'{activeConversation.Id}'.");
}
}
}
@@ -196,7 +196,7 @@ namespace Spring.Data.NHibernate.Support
{
if (isDebugEnabled)
{
- log.Debug($"activeConversation with 'session-per-conversation': Id:'{activeConversation.Id}'.");
+ log.LogDebug($"activeConversation with 'session-per-conversation': Id:'{activeConversation.Id}'.");
}
// single session mode
@@ -205,7 +205,7 @@ namespace Spring.Data.NHibernate.Support
// Do not modify the Session: just set the participate flag.
if (isDebugEnabled)
{
- log.Debug("Participating in existing NHibernate SessionFactory IS NOT ALLOWED.");
+ log.LogDebug("Participating in existing NHibernate SessionFactory IS NOT ALLOWED.");
}
throw new InvalidOperationException("Participating in existing NHibernate SessionFactory IS NOT ALLOWED.");
}
@@ -213,7 +213,7 @@ namespace Spring.Data.NHibernate.Support
{
if (isDebugEnabled)
{
- log.Debug("Opening single NHibernate Session in SessionPerConversationScope");
+ log.LogDebug("Opening single NHibernate Session in SessionPerConversationScope");
}
TransactionSynchronizationManager.BindResource(activeConversation.SessionFactory, new LazySessionPerConversationHolder(this, activeConversation, allManagedConversation));
@@ -226,7 +226,7 @@ namespace Spring.Data.NHibernate.Support
{
if (isDebugEnabled)
{
- log.Debug($"activeConversation with NO 'session-per-conversation': Id:'{activeConversation.Id}'.");
+ log.LogDebug($"activeConversation with NO 'session-per-conversation': Id:'{activeConversation.Id}'.");
}
}
}
@@ -250,7 +250,7 @@ namespace Spring.Data.NHibernate.Support
public void Close(ISessionFactory sessionFactory, ICollection allManagedConversation)
{
bool isDebugEnabled = log.IsEnabled(LogLevel.Debug);
- if (isDebugEnabled) log.Debug("Trying to close SessionPerConversationScope");
+ if (isDebugEnabled) log.LogDebug("Trying to close SessionPerConversationScope");
if (IsOpen)
{
@@ -266,14 +266,14 @@ namespace Spring.Data.NHibernate.Support
}
else
{
- if (isDebugEnabled) log.Debug("No open conversation - doing nothing");
+ if (isDebugEnabled) log.LogDebug("No open conversation - doing nothing");
}
}
private void DoClose(ISessionFactory sessionFactory, ICollection allManagedConversation, bool isLogDebugEnabled)
{
// single session mode
- if (isLogDebugEnabled) log.Debug("DoClose: Closing SessionPerConversationScope");
+ if (isLogDebugEnabled) log.LogDebug("DoClose: Closing SessionPerConversationScope");
Object holderObj = TransactionSynchronizationManager.UnbindResource(sessionFactory);
if (holderObj != null)
{
@@ -301,7 +301,7 @@ namespace Spring.Data.NHibernate.Support
{
if (isLogDebugEnabled)
{
- log.Warn("DoClose: TransactionSynchronizationManager.UnbindResource(sessionFactory) has no SessionHolder. Should I throw error?");
+ log.LogWarning("DoClose: TransactionSynchronizationManager.UnbindResource(sessionFactory) has no SessionHolder. Should I throw error?");
}
}
}
@@ -326,13 +326,13 @@ namespace Spring.Data.NHibernate.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"DoOpenSession: Conversation has a DbProvider: Id='{conversation.Id}'");
+ log.LogDebug($"DoOpenSession: Conversation has a DbProvider: Id='{conversation.Id}'");
}
if (!conversation.RootSessionPerConversation.IsConnected)
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"DoOpenSession: Conversation is not Connected: Id='{conversation.Id}'");
+ log.LogDebug($"DoOpenSession: Conversation is not Connected: Id='{conversation.Id}'");
}
DbConnection connection = (DbConnection) conversation.DbProvider.CreateConnection();
@@ -344,7 +344,7 @@ namespace Spring.Data.NHibernate.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"DoOpenSession: Conversation is already Connected: Id='{conversation.Id}'");
+ log.LogDebug($"DoOpenSession: Conversation is already Connected: Id='{conversation.Id}'");
}
}
}
@@ -352,7 +352,7 @@ namespace Spring.Data.NHibernate.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"DoOpenSession: Conversation has NO DbProvider: Id='{conversation.Id}'");
+ log.LogDebug($"DoOpenSession: Conversation has NO DbProvider: Id='{conversation.Id}'");
}
conversation.RootSessionPerConversation.Reconnect();
}
@@ -386,7 +386,7 @@ namespace Spring.Data.NHibernate.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Created LazyReconnectableSessionHolder");
+ log.LogDebug("Created LazyReconnectableSessionHolder");
}
this.owner = owner;
@@ -406,7 +406,7 @@ namespace Spring.Data.NHibernate.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("EnsureInitialized: 'session-per-conversation' instance requested - opening new session");
+ log.LogDebug("EnsureInitialized: 'session-per-conversation' instance requested - opening new session");
}
owner.DoOpenSession(activeConversation);
@@ -426,7 +426,7 @@ namespace Spring.Data.NHibernate.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("CloseAll LazySessionPerConversationHolder");
+ log.LogDebug("CloseAll LazySessionPerConversationHolder");
}
}
@@ -434,7 +434,7 @@ namespace Spring.Data.NHibernate.Support
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug($"CloseConversation: Id='{conversation.Id}'");
+ log.LogDebug($"CloseConversation: Id='{conversation.Id}'");
}
if (conversation.RootSessionPerConversation != null)
@@ -458,7 +458,7 @@ namespace Spring.Data.NHibernate.Support
}
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("Closed LazySessionPerConversationHolder");
+ log.LogDebug("Closed LazySessionPerConversationHolder");
}
}
}
diff --git a/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/HttpModule/ConversationModule.cs b/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/HttpModule/ConversationModule.cs
index 36253536..7b0796e8 100644
--- a/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/HttpModule/ConversationModule.cs
+++ b/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/HttpModule/ConversationModule.cs
@@ -75,10 +75,10 @@ namespace Spring.Web.Conversation.HttpModule
if (HttpContext.Current.Session != null)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug("context_PreRequestHandlerExecute: Processing HttpContext.Current.Session");
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug("context_PreRequestHandlerExecute: Processing HttpContext.Current.Session");
foreach (String convMngName in this.ConversationManagerNameList)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(string.Format("context_PreRequestHandlerExecute: Processing ConversationManager: {0}", convMngName));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(string.Format("context_PreRequestHandlerExecute: Processing ConversationManager: {0}", convMngName));
IConversationManager convMng = (IConversationManager)this.applicationContext.GetObject(convMngName);
convMng.EndOnTimeOut();
convMng.FreeEnded();
@@ -86,7 +86,7 @@ namespace Spring.Web.Conversation.HttpModule
}
else
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug("context_PreRequestHandlerExecute: no HttpContext.Current.Session found.");
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug("context_PreRequestHandlerExecute: no HttpContext.Current.Session found.");
}
}
}
@@ -102,10 +102,10 @@ namespace Spring.Web.Conversation.HttpModule
///
void page_Unload(object sender, EventArgs e)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug("page_Unload HttpContext.Current.Session is null: " + (HttpContext.Current.Session == null));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug("page_Unload HttpContext.Current.Session is null: " + (HttpContext.Current.Session == null));
foreach (String convMngName in this.ConversationManagerNameList)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(string.Format("page_Unload: Processing ConversationManager: {0}", convMngName));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(string.Format("page_Unload: Processing ConversationManager: {0}", convMngName));
IConversationManager convMng = (IConversationManager)this.applicationContext.GetObject(convMngName);
convMng.EndOnTimeOut();
convMng.FreeEnded();
@@ -115,12 +115,12 @@ namespace Spring.Web.Conversation.HttpModule
void context_EndRequest(object sender, EventArgs e)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug("context_EndRequest HttpContext.Current.Session is null: " + (HttpContext.Current.Session == null));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug("context_EndRequest HttpContext.Current.Session is null: " + (HttpContext.Current.Session == null));
}
void context_PostRequestHandlerExecute(object sender, EventArgs e)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug("context_PostRequestHandlerExecute HttpContext.Current.Session is null: " + (HttpContext.Current.Session == null));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug("context_PostRequestHandlerExecute HttpContext.Current.Session is null: " + (HttpContext.Current.Session == null));
if (HttpContext.Current.Session != null)
{
}
diff --git a/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/InnerConversationList.cs b/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/InnerConversationList.cs
index 1f79fcfd..c2d6065a 100644
--- a/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/InnerConversationList.cs
+++ b/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/InnerConversationList.cs
@@ -47,10 +47,10 @@ namespace Spring.Web.Conversation
{
String message = "'conversationOwner' can not be null";
- LOG.Error(message);
+ LOG.LogError(message);
throw new InvalidOperationException(message);
}
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Error(String.Format("Creating InnerConversationList for '{0}'", conversationOwner.Id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogError(String.Format("Creating InnerConversationList for '{0}'", conversationOwner.Id));
this.conversationOwner = conversationOwner;
}
@@ -60,7 +60,7 @@ namespace Spring.Web.Conversation
///
private void PreAddProcessor(IConversationState itemAdded)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("PreAddProcessor: added={0} into {1}", itemAdded, this.conversationOwner));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("PreAddProcessor: added={0} into {1}", itemAdded, this.conversationOwner));
this.ValidateCircularDependency(itemAdded);
if (itemAdded.ParentConversation != null && itemAdded.ParentConversation != this.conversationOwner)
{
@@ -74,7 +74,7 @@ namespace Spring.Web.Conversation
///
private void PostAddProcessor(IConversationState itemAdded)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("PostAddProcessor: added={0} into {1}", itemAdded, this.conversationOwner));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("PostAddProcessor: added={0} into {1}", itemAdded, this.conversationOwner));
if (itemAdded.ParentConversation == null)
{
itemAdded.ParentConversation = this.conversationOwner;
@@ -83,7 +83,7 @@ namespace Spring.Web.Conversation
private void ValidateCircularDependency(IConversationState itemAdded)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("Validating Circular Dependency: added={0} into {1}", itemAdded, this.conversationOwner));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("Validating Circular Dependency: added={0} into {1}", itemAdded, this.conversationOwner));
ICollection visitedColl = new HashedSet();
visitedColl.Add(conversationOwner);
@@ -105,7 +105,7 @@ namespace Spring.Web.Conversation
"ConversationState Circular Dependency detected: " +
path + "->" + convItem.Id;
- LOG.Error(exMsgStr);
+ LOG.LogError(exMsgStr);
throw new InvalidOperationException(exMsgStr);
}
diff --git a/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/WebConversationManager.cs b/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/WebConversationManager.cs
index 93183c85..a90eb921 100644
--- a/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/WebConversationManager.cs
+++ b/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/WebConversationManager.cs
@@ -80,7 +80,7 @@ namespace Spring.Web.Conversation
{
try
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug("EndOnTimeOut");
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug("EndOnTimeOut");
this.MutexEditDic.WaitOne(5000);
foreach (String keyItem in this.conversations.Keys)
{
@@ -89,7 +89,7 @@ namespace Spring.Web.Conversation
{
if (DateTime.Now.Subtract(conversationItem.LastAccess).TotalMilliseconds > conversationItem.TimeOut)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("Timeout for conversation '{0}'", conversationItem.Id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("Timeout for conversation '{0}'", conversationItem.Id));
conversationItem.EndConversation();
}
}
@@ -120,7 +120,7 @@ namespace Spring.Web.Conversation
{
try
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug("EndOnTimeOut");
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug("EndOnTimeOut");
this.MutexEditDic.WaitOne(5000);
List removeList = new List();
foreach (String keyItem in this.conversations.Keys)
@@ -128,7 +128,7 @@ namespace Spring.Web.Conversation
IConversationState conversationItem = this.conversations[keyItem];
if (conversationItem.Ended)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("FreeEnded: Release conversation '{0}'", conversationItem.Id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("FreeEnded: Release conversation '{0}'", conversationItem.Id));
removeList.Add(conversationItem);
}
}
@@ -140,7 +140,7 @@ namespace Spring.Web.Conversation
foreach (IConversationState conversationItem in removeList)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("FreeEnded: Remove conversation '{0}'", conversationItem.Id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("FreeEnded: Remove conversation '{0}'", conversationItem.Id));
conversationItem.EndConversation();
this.RemoveConversation(conversationItem);
}
@@ -184,7 +184,7 @@ namespace Spring.Web.Conversation
///
public void SetActiveConversation(IConversationState conversation)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("SetActiveConversation('{0}')", conversation.Id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("SetActiveConversation('{0}')", conversation.Id));
//Close connection for the last conversation, if it is open.
if (this.activeConversation != null && this.activeConversation != conversation)
@@ -265,10 +265,10 @@ namespace Spring.Web.Conversation
///
public override void Dispose()
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug("Dispose. End all Conversations");
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug("Dispose. End all Conversations");
foreach (String conversationId in this.conversations.Keys)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(string.Format("Ending Conversation for Conversation Id: {0}", conversationId));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(string.Format("Ending Conversation for Conversation Id: {0}", conversationId));
this.conversations[conversationId].EndConversation();
}
diff --git a/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/WebConversationSpringState.cs b/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/WebConversationSpringState.cs
index 374613a2..14dfb09b 100644
--- a/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/WebConversationSpringState.cs
+++ b/src/Spring/Spring.Web.Conversation.NHibernate5/Web/Conversation/WebConversationSpringState.cs
@@ -73,7 +73,7 @@ namespace Spring.Web.Conversation
///
public void EndConversation()
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("End of Conversation '{0}'", this.id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("End of Conversation '{0}'", this.id));
IDictionary springSessionScope = (IDictionary)HttpContext.Current.Session[SPRING_SESSSION_SCOPE_KEY];
if (springSessionScope == null)
@@ -83,12 +83,12 @@ namespace Spring.Web.Conversation
if (springSessionScope.Contains(this.Id))
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("EndConversation: Id='{0}' Was Found on 'spring session scope'!", this.id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("EndConversation: Id='{0}' Was Found on 'spring session scope'!", this.id));
springSessionScope.Remove(this.id);
}
else
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("EndConversation: Id='{0}' Was NOT Found on 'spring session scope!", this.id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("EndConversation: Id='{0}' Was NOT Found on 'spring session scope!", this.id));
}
List innerConversationsListTemp = new List(this.InnerConversations);
@@ -227,11 +227,11 @@ namespace Spring.Web.Conversation
}
if (this.ConversationManager != null)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("StartResumeConversation('{0}'): ConversationManager is not null.", this.Id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("StartResumeConversation('{0}'): ConversationManager is not null.", this.Id));
//if this is the root conversation.
if (this.ParentConversation == null)
{
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("SetActiveConversation('{0}'): ConversationManager is not null.", this.Id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("SetActiveConversation('{0}'): ConversationManager is not null.", this.Id));
//if this is the root conversation.
this.ConversationManager.SetActiveConversation(this);
@@ -388,7 +388,7 @@ namespace Spring.Web.Conversation
{
throw new InvalidOperationException(String.Format("Id is different from spring name for this instance.. Currents='{0}', springName='{1}'", this.id, value));
}
- if (LOG.IsEnabled(LogLevel.Debug)) LOG.Debug(String.Format("Begin of Conversation '{0}'", this.id));
+ if (LOG.IsEnabled(LogLevel.Debug)) LOG.LogDebug(String.Format("Begin of Conversation '{0}'", this.id));
}
}
diff --git a/src/Spring/Spring.Web.Mvc5/Context/Support/MvcApplicationContext.cs b/src/Spring/Spring.Web.Mvc5/Context/Support/MvcApplicationContext.cs
index 373f36d0..202750ea 100644
--- a/src/Spring/Spring.Web.Mvc5/Context/Support/MvcApplicationContext.cs
+++ b/src/Spring/Spring.Web.Mvc5/Context/Support/MvcApplicationContext.cs
@@ -71,7 +71,7 @@ namespace Spring.Context.Support
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("created instance " + this);
+ log.LogDebug("created instance " + this);
}
}
diff --git a/src/Spring/Spring.Web/Caching/AspNetCache.cs b/src/Spring/Spring.Web/Caching/AspNetCache.cs
index dcefd694..caf51f5d 100644
--- a/src/Spring/Spring.Web/Caching/AspNetCache.cs
+++ b/src/Spring/Spring.Web/Caching/AspNetCache.cs
@@ -204,7 +204,7 @@ namespace Spring.Caching
{
if (key != null)
{
- if (Log.IsEnabled(LogLevel.Debug)) Log.Debug(string.Format("removing item '{0}' from cache '{1}'", key, this._cacheName));
+ if (Log.IsEnabled(LogLevel.Debug)) Log.LogDebug(string.Format("removing item '{0}' from cache '{1}'", key, this._cacheName));
_cache.Remove(GenerateKey(key));
}
}
@@ -274,7 +274,7 @@ namespace Spring.Caching
AssertUtils.ArgumentNotNull(key, "key");
AssertUtils.State( TimeSpan.Zero <= timeToLive, "timeToLive" );
- if (Log.IsEnabled(LogLevel.Debug)) Log.Debug(string.Format("adding item '{0}' to cache '{1}'", key, this._cacheName));
+ if (Log.IsEnabled(LogLevel.Debug)) Log.LogDebug(string.Format("adding item '{0}' to cache '{1}'", key, this._cacheName));
if (TimeSpan.Zero < timeToLive)
{
diff --git a/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs b/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs
index 27d3865b..e95a4449 100644
--- a/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs
+++ b/src/Spring/Spring.Web/Context/Support/WebApplicationContext.cs
@@ -123,7 +123,7 @@ namespace Spring.Context.Support
this._constructionUrl = VirtualEnvironment.CurrentVirtualPathAndQuery;
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("created instance " + this.ToString());
+ log.LogDebug("created instance " + this.ToString());
}
}
@@ -169,23 +169,23 @@ namespace Spring.Context.Support
typeof(HttpRuntime).GetField("_beforeFirstRequest", BindingFlags.Instance | BindingFlags.NonPublic).
GetValue(runtime);
}
- s_weblog.Debug("BeforeFirstRequest:" + beforeFirstRequest);
+ s_weblog.LogDebug("BeforeFirstRequest:" + beforeFirstRequest);
if (beforeFirstRequest)
{
try
{
string firstRequestPath = HttpRuntime.AppDomainAppVirtualPath.TrimEnd('/') + "/dummy.context";
- s_weblog.Info("Forcing first request " + firstRequestPath);
+ s_weblog.LogInformation("Forcing first request " + firstRequestPath);
SafeMethod fnProcessRequestNow = new SafeMethod(typeof(HttpRuntime).GetMethod("ProcessRequestNow", BindingFlags.Static | BindingFlags.NonPublic));
SimpleWorkerRequest wr = new SimpleWorkerRequest(firstRequestPath, string.Empty, new StringWriter());
fnProcessRequestNow.Invoke(null, new object[] { wr });
// HttpRuntime.ProcessRequest(
// wr);
- s_weblog.Info("Successfully processed first request!");
+ s_weblog.LogInformation("Successfully processed first request!");
}
catch (Exception ex)
{
- s_weblog.Error("Failed processing first request", ex);
+ s_weblog.LogError(ex, "Failed processing first request");
throw;
}
}
@@ -203,7 +203,7 @@ namespace Spring.Context.Support
ILog s_weblog = LogManager.GetLogger(typeof(WebApplicationContext));
if (s_weblog.IsEnabled(LogLevel.Debug))
{
- s_weblog.Debug("received ContextRegistry.Cleared event - clearing webContextCache");
+ s_weblog.LogDebug("received ContextRegistry.Cleared event - clearing webContextCache");
}
s_webContextCache.Clear();
}
@@ -253,7 +253,7 @@ namespace Spring.Context.Support
{
if (isLogDebugEnabled)
{
- s_weblog.Debug(string.Format("looking up web context '{0}' in WebContextCache", contextName));
+ s_weblog.LogDebug(string.Format("looking up web context '{0}' in WebContextCache", contextName));
}
// first lookup in our own cache
IApplicationContext context = (IApplicationContext)s_webContextCache[contextName];
@@ -262,8 +262,7 @@ namespace Spring.Context.Support
// found - nothing to do anymore
if (isLogDebugEnabled)
{
- s_weblog.Debug(
- string.Format("returning WebContextCache hit '{0}' for vpath '{1}' ", context, contextName));
+ s_weblog.LogDebug(string.Format("returning WebContextCache hit '{0}' for vpath '{1}' ", context, contextName));
}
return context;
}
@@ -273,7 +272,7 @@ namespace Spring.Context.Support
{
if (isLogDebugEnabled)
{
- s_weblog.Debug(string.Format("looking up web context '{0}' in ContextRegistry", contextName));
+ s_weblog.LogDebug(string.Format("looking up web context '{0}' in ContextRegistry", contextName));
}
if (ContextRegistry.IsContextRegistered(contextName))
@@ -288,10 +287,9 @@ namespace Spring.Context.Support
{
if (isLogDebugEnabled)
{
- s_weblog.Debug(
- string.Format(
- "web context for vpath '{0}' not found. Force creation using filepath '{1}'",
- contextName, virtualPath));
+ s_weblog.LogDebug(string.Format(
+ "web context for vpath '{0}' not found. Force creation using filepath '{1}'",
+ contextName, virtualPath));
}
// assure context is resolved to the given virtualDirectory
@@ -303,19 +301,20 @@ namespace Spring.Context.Support
if (context != null)
{
if (isLogDebugEnabled)
- s_weblog.Debug(string.Format("got context '{0}' for vpath '{1}'", context, contextName));
+ s_weblog.LogDebug(string.Format("got context '{0}' for vpath '{1}'", context, contextName));
}
else
{
if (isLogDebugEnabled)
- s_weblog.Debug(string.Format("no context defined for vpath '{0}'", contextName));
+ s_weblog.LogDebug(string.Format("no context defined for vpath '{0}'", contextName));
}
}
catch (Exception ex)
{
if (s_weblog.IsEnabled(LogLevel.Error))
{
- s_weblog.Error(string.Format("failed creating context '{0}', Stacktrace:\n{1}", contextName, new StackTrace()), ex);
+ string message = string.Format("failed creating context '{0}', Stacktrace:\n{1}", contextName, new StackTrace());
+ s_weblog.LogError(ex, message);
}
throw;
@@ -328,8 +327,7 @@ namespace Spring.Context.Support
s_webContextCache.Add(contextName, context);
if (isLogDebugEnabled)
{
- s_weblog.Debug(
- string.Format("added context '{0}' to WebContextCache for vpath '{1}'", context, contextName));
+ s_weblog.LogDebug(string.Format("added context '{0}' to WebContextCache for vpath '{1}'", context, contextName));
}
if (context != null)
@@ -343,9 +341,8 @@ namespace Spring.Context.Support
s_webContextCache.Add(parentContext.Name, parentContext);
if (isLogDebugEnabled)
{
- s_weblog.Debug(
- string.Format("added parent context '{0}' to WebContextCache for vpath '{1}'",
- parentContext, parentContext.Name));
+ s_weblog.LogDebug(string.Format("added parent context '{0}' to WebContextCache for vpath '{1}'",
+ parentContext, parentContext.Name));
}
}
parentContext = parentContext.ParentContext;
diff --git a/src/Spring/Spring.Web/Context/Support/WebContextHandler.cs b/src/Spring/Spring.Web/Context/Support/WebContextHandler.cs
index 667aa705..b321e96c 100644
--- a/src/Spring/Spring.Web/Context/Support/WebContextHandler.cs
+++ b/src/Spring/Spring.Web/Context/Support/WebContextHandler.cs
@@ -104,9 +104,8 @@ namespace Spring.Context.Support
IApplicationContext ctx = ContextRegistry.GetContext(contextName);
if (Log.IsEnabled(LogLevel.Debug))
{
- Log.Debug(
- string.Format("web context '{0}' already registered - returning existing instance {1}",
- contextName, ctx));
+ Log.LogDebug(string.Format("web context '{0}' already registered - returning existing instance {1}",
+ contextName, ctx));
}
return ctx;
}
diff --git a/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs b/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs
index 34580fc2..6db95db2 100644
--- a/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs
+++ b/src/Spring/Spring.Web/Context/Support/WebSupportModule.cs
@@ -100,7 +100,7 @@ namespace Spring.Context.Support
}
catch(SecurityException sec)
{
- s_log.Warn(string.Format("failed reflecting field HttpContext.HideRequestResponse due to security restrictions {0}", sec));
+ s_log.LogWarning(string.Format("failed reflecting field HttpContext.HideRequestResponse due to security restrictions {0}", sec));
}
// register additional resource handler
@@ -112,7 +112,7 @@ namespace Spring.Context.Support
// default to hybrid thread storage implementation
LogicalThreadContext.SetStorage(new HybridContextStorage());
- s_log.Debug("Set default resource protocol to 'web' and installed HttpContext-aware HybridContextStorage");
+ s_log.LogDebug("Set default resource protocol to 'web' and installed HttpContext-aware HybridContextStorage");
}
///
@@ -122,7 +122,7 @@ namespace Spring.Context.Support
{
lock (typeof(WebSupportModule))
{
- s_log.Debug("Initializing Application instance");
+ s_log.LogDebug("Initializing Application instance");
if (!s_isInitialized)
{
HttpModuleCollection modules = app.Modules;
@@ -232,14 +232,14 @@ namespace Spring.Context.Support
{
if (context.Handler != null)
{
- s_log.Debug(string.Format("previous handler is present - configuring handler now using application context '{0}' and name '{1}'", applicationContext, name));
+ s_log.LogDebug(string.Format("previous handler is present - configuring handler now using application context '{0}' and name '{1}'", applicationContext, name));
// this is a Server.Execute() or Server.Transfer() request -> configure immediately
return ConfigureHandlerNow(handler, applicationContext, name, isContainerManaged);
}
else
{
// remember the resolved object definition name for applying it during PreRequestHandlerExecute
- s_log.Debug(string.Format("no previous handler is present - defer handler configuration using application context '{0}' and name '{1}'", applicationContext, name));
+ s_log.LogDebug(string.Format("no previous handler is present - defer handler configuration using application context '{0}' and name '{1}'", applicationContext, name));
SetCurrentHandlerConfiguration(applicationContext, name, isContainerManaged);
return handler;
}
@@ -267,12 +267,12 @@ namespace Spring.Context.Support
{
if (isContainerManaged)
{
- s_log.Debug(string.Format("configuring managed handler using application context '{0}' and name '{1}'", applicationContext, name));
+ s_log.LogDebug(string.Format("configuring managed handler using application context '{0}' and name '{1}'", applicationContext, name));
handler = (IHttpHandler)applicationContext.ObjectFactory.ConfigureObject(handler, name);
}
else
{
- s_log.Debug(string.Format("configuring unmanaged handler using application context '{0}' and name '{1}'", applicationContext, name));
+ s_log.LogDebug(string.Format("configuring unmanaged handler using application context '{0}' and name '{1}'", applicationContext, name));
// at a minimum we'll apply ObjectPostProcessors
handler = (IHttpHandler)applicationContext.ObjectFactory.ApplyObjectPostProcessorsBeforeInitialization(handler, name);
handler = (IHttpHandler)applicationContext.ObjectFactory.ApplyObjectPostProcessorsAfterInitialization(handler, name);
@@ -295,7 +295,7 @@ namespace Spring.Context.Support
private static void OnCacheItemRemoved(string key, object value, CacheItemRemovedReason reason)
{
- s_log.Debug("end session " + key + " because of " + reason);
+ s_log.LogDebug("end session " + key + " because of " + reason);
try
{
@@ -309,7 +309,7 @@ namespace Spring.Context.Support
// are we on a current request?
if (HttpContext.Current != null)
{
- s_log.Error(msg, ex);
+ s_log.LogError(ex, msg);
}
else
{
@@ -332,7 +332,7 @@ namespace Spring.Context.Support
object store = ExpressionEvaluator.GetValue(sessionStateModule, "_store");
if ((store != null) && store.GetType().Name == "InProcSessionStateStore")
{
- s_log.Debug("attaching to InProcSessionStateStore");
+ s_log.LogDebug("attaching to InProcSessionStateStore");
s_originalCallback = (CacheItemRemovedCallback)ExpressionEvaluator.GetValue(store, "_callback");
ExpressionEvaluator.SetValue(store, "_callback", new CacheItemRemovedCallback(OnCacheItemRemoved));
diff --git a/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs b/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs
index 5deaae66..2a0c147e 100644
--- a/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs
+++ b/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs
@@ -82,7 +82,7 @@ namespace Spring.Objects.Factory.Support
{
if (s_eventHandlersRegistered) return;
- if (log.IsEnabled(LogLevel.Debug)) log.Debug("hooking up event handlers");
+ if (log.IsEnabled(LogLevel.Debug)) log.LogDebug("hooking up event handlers");
VirtualEnvironment.EndRequest += OnEndRequest;
VirtualEnvironment.EndSession += OnEndSession;
@@ -484,7 +484,7 @@ namespace Spring.Objects.Factory.Support
if (items != null)
{
- log.Debug("disposing 'request'-scoped item cache");
+ log.LogDebug("disposing 'request'-scoped item cache");
ArrayList keys = new ArrayList(items.Keys);
for (int i = 0; i < keys.Count; i++)
{
@@ -513,7 +513,7 @@ namespace Spring.Objects.Factory.Support
}
if (items != null)
{
- log.Debug("disposing 'session'-scoped item cache");
+ log.LogDebug("disposing 'session'-scoped item cache");
object key = null;
try
{
diff --git a/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectUtils.cs b/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectUtils.cs
index 27e5a216..0b3661db 100644
--- a/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectUtils.cs
+++ b/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectUtils.cs
@@ -68,7 +68,7 @@ namespace Spring.Objects.Factory.Support
{
if (s_log.IsEnabled(LogLevel.Debug))
{
- s_log.Debug( "creating page instance '" + pageUrl + "'" );
+ s_log.LogDebug("creating page instance '" + pageUrl + "'");
}
IHttpHandler page;
@@ -83,7 +83,7 @@ namespace Spring.Objects.Factory.Support
{
throw new FileNotFoundException( msg );
}
- s_log.Error( msg, httpEx );
+ s_log.LogError(httpEx, msg);
throw new ObjectCreationException( msg, httpEx );
}
catch (Exception ex)
@@ -97,7 +97,7 @@ namespace Spring.Objects.Factory.Support
}
string msg = String.Format( "Unable to instantiate page [{0}]", pageUrl );
- s_log.Error( msg, ex );
+ s_log.LogError(ex, msg);
throw new ObjectCreationException( msg, ex );
}
return page;
@@ -161,7 +161,7 @@ namespace Spring.Objects.Factory.Support
catch (Exception ex)
{
string msg = String.Format( "Unable to get page type for url [{0}]", pageUrl );
- s_log.Error( msg, ex );
+ s_log.LogError(ex, msg);
throw new ObjectCreationException( msg, ex );
}
}
@@ -181,19 +181,19 @@ namespace Spring.Objects.Factory.Support
{
if (s_log.IsEnabled(LogLevel.Debug))
{
- s_log.Debug( "getting page type for " + pageUrl );
+ s_log.LogDebug("getting page type for " + pageUrl);
}
string rootedVPath = WebUtils.CombineVirtualPaths( VirtualEnvironment.CurrentExecutionFilePath, pageUrl );
if (s_log.IsEnabled(LogLevel.Debug))
{
- s_log.Debug( "page vpath is " + rootedVPath );
+ s_log.LogDebug("page vpath is " + rootedVPath);
}
Type pageType = VirtualEnvironment.GetCompiledType(rootedVPath);
if (s_log.IsEnabled(LogLevel.Debug))
{
- s_log.Debug( string.Format( "got page type '{0}' for vpath '{1}'", pageType.FullName, rootedVPath ) );
+ s_log.LogDebug(string.Format( "got page type '{0}' for vpath '{1}'", pageType.FullName, rootedVPath ));
}
return pageType;
}
@@ -207,7 +207,7 @@ namespace Spring.Objects.Factory.Support
AssertUtils.ArgumentHasText( controlName, "controlName" );
if (s_log.IsEnabled(LogLevel.Debug))
{
- s_log.Debug( "getting control type for " + controlName );
+ s_log.LogDebug("getting control type for " + controlName);
}
// HttpContext ctx = HttpContext.Current;
@@ -220,7 +220,7 @@ namespace Spring.Objects.Factory.Support
if (s_log.IsEnabled(LogLevel.Debug))
{
- s_log.Debug( "control vpath is " + rootedVPath );
+ s_log.LogDebug("control vpath is " + rootedVPath);
}
Type controlType;
@@ -240,7 +240,7 @@ namespace Spring.Objects.Factory.Support
if (s_log.IsEnabled(LogLevel.Debug))
{
- s_log.Debug( string.Format( "got control type '{0}' for vpath '{1}'", controlType.FullName, rootedVPath ) );
+ s_log.LogDebug(string.Format( "got control type '{0}' for vpath '{1}'", controlType.FullName, rootedVPath ));
}
return controlType;
}
diff --git a/src/Spring/Spring.Web/Objects/Factory/Xml/WebObjectDefinitionParserHelper.cs b/src/Spring/Spring.Web/Objects/Factory/Xml/WebObjectDefinitionParserHelper.cs
index c09eed85..1019dd2c 100644
--- a/src/Spring/Spring.Web/Objects/Factory/Xml/WebObjectDefinitionParserHelper.cs
+++ b/src/Spring/Spring.Web/Objects/Factory/Xml/WebObjectDefinitionParserHelper.cs
@@ -150,8 +150,9 @@ namespace Spring.Objects.Factory.Xml
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug(string.Format("Error while parsing object scope : '{0}' is an invalid value.",
- value), ex);
+ string message = string.Format("Error while parsing object scope : '{0}' is an invalid value.",
+ value);
+ log.LogDebug(ex, message);
}
#endregion
diff --git a/src/Spring/Spring.Web/Util/VirtualEnvironment.cs b/src/Spring/Spring.Web/Util/VirtualEnvironment.cs
index c5a11bf6..78a6eced 100644
--- a/src/Spring/Spring.Web/Util/VirtualEnvironment.cs
+++ b/src/Spring/Spring.Web/Util/VirtualEnvironment.cs
@@ -262,7 +262,7 @@ namespace Spring.Util
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("rewriting path from " + currentFileDirectory + " to " + newPath + " results in " + ctx.Request.FilePath);
+ log.LogDebug("rewriting path from " + currentFileDirectory + " to " + newPath + " results in " + ctx.Request.FilePath);
}
#endregion
@@ -275,7 +275,7 @@ namespace Spring.Util
{
if (log.IsEnabled(LogLevel.Debug))
{
- log.Debug("restoring path from " + ctx.Request.FilePath + " back to " + originalPath);
+ log.LogDebug("restoring path from " + ctx.Request.FilePath + " back to " + originalPath);
}
ctx.RewritePath(originalPath, rebaseClientPath);
diff --git a/src/Spring/Spring.Web/Web/Support/AbstractHandlerFactory.cs b/src/Spring/Spring.Web/Web/Support/AbstractHandlerFactory.cs
index 3c52a2b8..87fc2e68 100644
--- a/src/Spring/Spring.Web/Web/Support/AbstractHandlerFactory.cs
+++ b/src/Spring/Spring.Web/Web/Support/AbstractHandlerFactory.cs
@@ -172,7 +172,7 @@ namespace Spring.Web.Support
#region Instrumentation
if (isDebug)
- Log.Debug(string.Format("GetHandler():resolving url '{0}'", url));
+ Log.LogDebug(string.Format("GetHandler():resolving url '{0}'", url));
#endregion
@@ -188,7 +188,7 @@ namespace Spring.Web.Support
if (isDebug)
{
- Log.Debug(string.Format("GetHandler():resolved url '{0}' from reusable handler cache", url));
+ Log.LogDebug(string.Format("GetHandler():resolved url '{0}' from reusable handler cache", url));
}
#endregion
@@ -299,7 +299,7 @@ namespace Spring.Web.Support
// lookup definition using app-relative url
if (isDebug)
- Log.Debug(string.Format("GetHandler():looking up definition for app-relative url '{0}'", appRelativeVirtualPath));
+ Log.LogDebug(string.Format("GetHandler():looking up definition for app-relative url '{0}'", appRelativeVirtualPath));
string objectDefinitionName = appRelativeVirtualPath;
IObjectDefinition pageDefinition = objectFactory.GetObjectDefinition(appRelativeVirtualPath, true);
@@ -324,18 +324,18 @@ namespace Spring.Web.Support
if (pageDefinition != null)
{
if (isDebug)
- Log.Debug(string.Format("GetHandler():found definition for page-name '{0}'", objectDefinitionName));
+ Log.LogDebug(string.Format("GetHandler():found definition for page-name '{0}'", objectDefinitionName));
}
else
{
if (isDebug)
- Log.Debug(string.Format("GetHandler():no definition found for page-name '{0}'", pageName));
+ Log.LogDebug(string.Format("GetHandler():no definition found for page-name '{0}'", pageName));
}
}
else
{
if (isDebug)
- Log.Debug(string.Format("GetHandler():found definition for page-url '{0}'", appRelativeVirtualPath));
+ Log.LogDebug(string.Format("GetHandler():found definition for page-url '{0}'", appRelativeVirtualPath));
}
return (pageDefinition == null) ? (NamedObjectDefinition)null : new NamedObjectDefinition(objectDefinitionName, pageDefinition);
diff --git a/src/Spring/Spring.Web/Web/Support/ControlInterceptor.cs b/src/Spring/Spring.Web/Web/Support/ControlInterceptor.cs
index 3e2c5aa6..b738da97 100644
--- a/src/Spring/Spring.Web/Web/Support/ControlInterceptor.cs
+++ b/src/Spring/Spring.Web/Web/Support/ControlInterceptor.cs
@@ -20,6 +20,7 @@
using System.Collections;
using System.Web.UI;
+using Microsoft.Extensions.Logging;
using Spring.Context;
#endregion
@@ -157,7 +158,7 @@ namespace Spring.Web.Support
}
if (!bOk)
{
- LogManager.GetLogger( typeof( ControlInterceptor ) ).Warn( string.Format( "dependency injection not supported for control type {0}", ctlAccessor.GetTarget().GetType() ) );
+ LogManager.GetLogger( typeof( ControlInterceptor ) ).LogWarning(string.Format( "dependency injection not supported for control type {0}", ctlAccessor.GetTarget().GetType() ));
strategy = s_noopInterceptionStrategy;
}
}
diff --git a/src/Spring/Spring.Web/Web/Support/HandlerMap.cs b/src/Spring/Spring.Web/Web/Support/HandlerMap.cs
index 656c2712..21e4b87b 100644
--- a/src/Spring/Spring.Web/Web/Support/HandlerMap.cs
+++ b/src/Spring/Spring.Web/Web/Support/HandlerMap.cs
@@ -67,18 +67,18 @@ namespace Spring.Web.Support
/// the object name
public HandlerMapEntry MapPath( string virtualPath )
{
- if(Log.IsEnabled(LogLevel.Debug)) Log.Debug( string.Format( "looking up mapping for url '{0}'", virtualPath ) );
+ if(Log.IsEnabled(LogLevel.Debug)) Log.LogDebug(string.Format( "looking up mapping for url '{0}'", virtualPath ));
for(int i=0;i GetAdvicesAndAdvisorsForObject(Type targetType, string targetName, ITargetSource customTargetSource)
{
- _logger.Trace("GetAdvicesAndAdvisorsForObject begin");
+ _logger.LogTrace("GetAdvicesAndAdvisorsForObject begin");
IList