docker 日志从 .NET Core 控制台应用程序输出
问题描述:
我是否应该使用 docker logs 命令从我的 .NET Core 控制台应用程序(linux 映像)中看到控制台输出 (Console.WriteLine)?
Should I see console output (Console.WriteLine) from my .NET Core console app dockerized (linux image) by using docker logs command?
答
发现在调试模式下,应用程序只写入调试输出控制台.因此,如果您在本地调试容器上运行 docker logs
将什么也没有.如果您在发布模式下运行容器,则在运行 docker logs
Found out that in debug mode the app only writes to the debug output console. So if you run docker logs
on a local debugging container there will be nothing. If you run the container in release mode then the logs will be present when running a docker logs