diff --git a/src/Orchard/Logging/LoggingModule.cs b/src/Orchard/Logging/LoggingModule.cs index b67da4b9c..93e70e1d8 100644 --- a/src/Orchard/Logging/LoggingModule.cs +++ b/src/Orchard/Logging/LoggingModule.cs @@ -16,11 +16,10 @@ namespace Orchard.Logging { // by default, use Orchard's logger that delegates to Castle's logger factory moduleBuilder.RegisterType().As().InstancePerLifetimeScope(); - try { - // by default, use Castle's TraceSource based logger factory - new SecurityPermission(SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.ControlPolicy).Demand(); + // Register logger type + if (AppDomain.CurrentDomain.IsHomogenous && AppDomain.CurrentDomain.IsFullyTrusted) { moduleBuilder.RegisterType().As().InstancePerLifetimeScope(); - } catch (SecurityException) { + } else { // if security model does not allow it, fall back to null logger factory moduleBuilder.RegisterType().As().InstancePerLifetimeScope(); }