Skip to content

Commit 0394a45

Browse files
captainsafiapranavkm
authored andcommitted
Fix logging config and output redirection in DebugProxy (#22157)
* Fix logging config and output redirection in DebugProxy * Log all messages from DebugProxy
1 parent 53edc76 commit 0394a45

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/Components/WebAssembly/DebugProxy/src/Hosting/DebugProxyHost.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.IO;
67
using System.Text;
78
using Microsoft.AspNetCore.Hosting;
89
using Microsoft.Extensions.Configuration;
@@ -31,6 +32,7 @@ public static IHostBuilder CreateDefaultBuilder(string[] args, string browserHos
3132
{
3233
config.AddCommandLine(args);
3334
}
35+
config.SetBasePath(Directory.GetCurrentDirectory());
3436
config.AddJsonFile("blazor-debugproxysettings.json", optional: true, reloadOnChange: true);
3537
})
3638
.ConfigureLogging((hostingContext, logging) =>

src/Components/WebAssembly/DebugProxy/src/MonoDebugProxy/ws-proxy/DevToolsProxy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ protected void Log (string priority, string msg)
320320
{
321321
switch (priority) {
322322
case "protocol":
323-
//logger.LogTrace (msg);
323+
logger.LogTrace (msg);
324324
break;
325325
case "verbose":
326-
//logger.LogDebug (msg);
326+
logger.LogDebug (msg);
327327
break;
328328
case "info":
329329
case "warning":

src/Components/WebAssembly/Server/src/DebugProxyLauncher.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ private static async Task<string> LaunchAndGetUrl(IServiceProvider serviceProvid
5555
RemoveUnwantedEnvironmentVariables(processStartInfo.Environment);
5656

5757
var debugProxyProcess = Process.Start(processStartInfo);
58+
PassThroughConsoleOutput(debugProxyProcess);
5859
CompleteTaskWhenServerIsReady(debugProxyProcess, tcs);
5960

6061
new CancellationTokenSource(DebugProxyLaunchTimeout).Token.Register(() =>
@@ -97,6 +98,14 @@ private static string LocateDebugProxyExecutable(IWebHostEnvironment environment
9798
return debugProxyPath;
9899
}
99100

101+
private static void PassThroughConsoleOutput(Process process)
102+
{
103+
process.OutputDataReceived += (sender, eventArgs) =>
104+
{
105+
Console.WriteLine(eventArgs.Data);
106+
};
107+
}
108+
100109
private static void CompleteTaskWhenServerIsReady(Process aspNetProcess, TaskCompletionSource<string> taskCompletionSource)
101110
{
102111
string capturedUrl = null;

0 commit comments

Comments
 (0)