@@ -457,6 +457,10 @@ protected virtual IEnumerable<string> GetLoggerDefinitions()
457457 if ( loggerDefinitions . Any ( l => Regex . IsMatch ( l , "^file" , RegexOptions . IgnoreCase ) ) )
458458 {
459459 // only add proxy logger if user also asked for file logging.
460+ loggerDefinitions . Add ( $ "proxy;file;{ this . ProxyApiUri . ToString ( ) } ") ;
461+ }
462+ else
463+ {
460464 loggerDefinitions . Add ( $ "proxy;{ this . ProxyApiUri . ToString ( ) } ") ;
461465 }
462466
@@ -684,7 +688,8 @@ protected virtual IList<ILoggerProvider> InitializeLoggerProviders(IConfiguratio
684688 break ;
685689
686690 case "proxy" :
687- CommandBase . AddProxyApiLogging ( loggingProviders , configuration , platformSpecifics , new Uri ( loggerParameters ) , this . CertificateManager , source ) ;
691+
692+ CommandBase . AddProxyApiLogging ( loggingProviders , configuration , platformSpecifics , loggerParameters , this . CertificateManager , source ) ;
688693 break ;
689694
690695 case "summary" :
@@ -805,14 +810,21 @@ private static void AddFileLogging(List<ILoggerProvider> loggingProviders, IConf
805810 }
806811 }
807812
808- private static void AddProxyApiLogging ( List < ILoggerProvider > loggingProviders , IConfiguration configuration , PlatformSpecifics specifics , Uri proxyApiUri , ICertificateManager certificateManager , string source = null )
813+ private static void AddProxyApiLogging ( List < ILoggerProvider > loggingProviders , IConfiguration configuration , PlatformSpecifics specifics , string parameters , ICertificateManager certificateManager , string source = null )
809814 {
810- if ( proxyApiUri != null )
815+ ILogger debugLogger = null ;
816+ if ( parameters . StartsWith ( "file;" , StringComparison . OrdinalIgnoreCase ) )
811817 {
812- ILogger debugLogger = DependencyFactory . CreateFileLoggerProvider ( specifics . GetLogsPath ( "proxy-traces.log" ) , TimeSpan . FromSeconds ( 5 ) , LogLevel . Trace )
818+ debugLogger = DependencyFactory . CreateFileLoggerProvider ( specifics . GetLogsPath ( "proxy-traces.log" ) , TimeSpan . FromSeconds ( 5 ) , LogLevel . Trace )
813819 . CreateLogger ( "Proxy" ) ;
814820
815821 CommandBase . proxyApiDebugLoggers . Add ( debugLogger ) ;
822+ parameters = parameters . Substring ( "file;" . Length ) ;
823+ }
824+
825+ if ( ! string . IsNullOrEmpty ( parameters ) )
826+ {
827+ Uri proxyApiUri = new Uri ( parameters ) ;
816828
817829 X509Certificate2 certificate = null ;
818830 if ( EndpointUtility . TryParseCertificateReference ( proxyApiUri , out string issuer , out string subject ) )
0 commit comments