@@ -75,28 +75,33 @@ private static void TryLoadConfigurationFromContentRootPath(LogFactory logFactor
75
75
config . Configuration = config . LogFactory . Configuration ;
76
76
if ( ! IsLoggingConfigurationLoaded ( config . Configuration ) )
77
77
{
78
- var standardPath = System . IO . Path . Combine ( contentRootPath , "NLog.config" ) ;
79
- if ( System . IO . File . Exists ( standardPath ) )
80
- {
81
- config . Configuration = new XmlLoggingConfiguration ( standardPath , config . LogFactory ) ;
82
- }
83
- else
84
- {
85
- var lowercasePath = System . IO . Path . Combine ( contentRootPath , "nlog.config" ) ;
86
- if ( System . IO . File . Exists ( lowercasePath ) )
87
- {
88
- config . Configuration = new XmlLoggingConfiguration ( lowercasePath , config . LogFactory ) ;
89
- }
90
- else
91
- {
92
- config . Configuration = null ; // Perform default loading
93
- }
94
- }
78
+ config . Configuration = LoadXmlLoggingConfigurationFromPath ( contentRootPath , config . LogFactory ) ;
95
79
}
96
80
}
97
81
} ) ;
98
82
}
99
83
84
+ private static LoggingConfiguration LoadXmlLoggingConfigurationFromPath ( string contentRootPath , LogFactory logFactory )
85
+ {
86
+ var standardPath = System . IO . Path . Combine ( contentRootPath , "NLog.config" ) ;
87
+ if ( System . IO . File . Exists ( standardPath ) )
88
+ {
89
+ return new XmlLoggingConfiguration ( standardPath , logFactory ) ;
90
+ }
91
+ else
92
+ {
93
+ var lowercasePath = System . IO . Path . Combine ( contentRootPath , "nlog.config" ) ;
94
+ if ( System . IO . File . Exists ( lowercasePath ) )
95
+ {
96
+ return new XmlLoggingConfiguration ( lowercasePath , logFactory ) ;
97
+ }
98
+ else
99
+ {
100
+ return null ; // Perform default loading
101
+ }
102
+ }
103
+ }
104
+
100
105
private static bool IsLoggingConfigurationLoaded ( LoggingConfiguration cfg )
101
106
{
102
107
return cfg ? . LoggingRules ? . Count > 0 && cfg ? . AllTargets ? . Count > 0 ;
0 commit comments