diff --git a/src/NzbDrone.Core/Datastore/LazyLoaded.cs b/src/NzbDrone.Core/Datastore/LazyLoaded.cs
index c5dbde360..91ff44c82 100644
--- a/src/NzbDrone.Core/Datastore/LazyLoaded.cs
+++ b/src/NzbDrone.Core/Datastore/LazyLoaded.cs
@@ -1,4 +1,6 @@
using System;
+using NLog;
+using NzbDrone.Common.Instrumentation;
namespace NzbDrone.Core.Datastore
{
@@ -74,6 +76,8 @@ namespace NzbDrone.Core.Datastore
/// The child entity that is being lazy loaded.
internal class LazyLoaded : LazyLoaded
{
+ private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(LazyLoaded));
+
private readonly Func _query;
private readonly Func _condition;
@@ -115,6 +119,12 @@ namespace NzbDrone.Core.Datastore
{
if (_condition != null && _condition(_parent))
{
+ if (SqlBuilderExtensions.LogSql)
+ {
+ Logger.Trace($"Lazy loading {typeof(TChild)} for {typeof(TParent)}");
+ Logger.Trace("StackTrace: '{0}'", Environment.StackTrace);
+ }
+
_value = _query(_database, _parent);
}
else