Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.18
2.1.19
20 changes: 16 additions & 4 deletions src/VirtualClient/VirtualClient.Main/CommandBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ protected virtual IEnumerable<string> GetLoggerDefinitions()
if (loggerDefinitions.Any( l => Regex.IsMatch(l, "^file", RegexOptions.IgnoreCase)))
{
// only add proxy logger if user also asked for file logging.
loggerDefinitions.Add($"proxy;file;{this.ProxyApiUri.ToString()}");
}
else
{
loggerDefinitions.Add($"proxy;{this.ProxyApiUri.ToString()}");
}

Expand Down Expand Up @@ -684,7 +688,8 @@ protected virtual IList<ILoggerProvider> InitializeLoggerProviders(IConfiguratio
break;

case "proxy":
CommandBase.AddProxyApiLogging(loggingProviders, configuration, platformSpecifics, new Uri(loggerParameters), this.CertificateManager, source);

CommandBase.AddProxyApiLogging(loggingProviders, configuration, platformSpecifics, loggerParameters, this.CertificateManager, source);
break;

case "summary":
Expand Down Expand Up @@ -805,14 +810,21 @@ private static void AddFileLogging(List<ILoggerProvider> loggingProviders, IConf
}
}

private static void AddProxyApiLogging(List<ILoggerProvider> loggingProviders, IConfiguration configuration, PlatformSpecifics specifics, Uri proxyApiUri, ICertificateManager certificateManager, string source = null)
private static void AddProxyApiLogging(List<ILoggerProvider> loggingProviders, IConfiguration configuration, PlatformSpecifics specifics, string parameters, ICertificateManager certificateManager, string source = null)
{
if (proxyApiUri != null)
ILogger debugLogger = null;
if (parameters.StartsWith("file;", StringComparison.OrdinalIgnoreCase))
{
ILogger debugLogger = DependencyFactory.CreateFileLoggerProvider(specifics.GetLogsPath("proxy-traces.log"), TimeSpan.FromSeconds(5), LogLevel.Trace)
debugLogger = DependencyFactory.CreateFileLoggerProvider(specifics.GetLogsPath("proxy-traces.log"), TimeSpan.FromSeconds(5), LogLevel.Trace)
.CreateLogger("Proxy");

CommandBase.proxyApiDebugLoggers.Add(debugLogger);
parameters = parameters.Substring("file;".Length);
}

if (!string.IsNullOrEmpty(parameters))
{
Uri proxyApiUri = new Uri(parameters);

X509Certificate2 certificate = null;
if (EndpointUtility.TryParseCertificateReference(proxyApiUri, out string issuer, out string subject))
Expand Down
Loading