Reputation: 1527
I am creating an API using ASP.NET Core. Now I produce logs in console for speed.
I want to create a Go application that reads those logs produced by ASP.NET Core (they will be run in the same host in different containers).
My question how do you go about reading the console output of the ASP.NET Core logging with Go. I use the default logging:
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
})
Also I read that you can output logs in a docker container, so would that be a best option?. What is generally the best option for my problem.
Upvotes: 0
Views: 3005
Reputation: 140
There are two go docker clients, i know.
Both of them have log
methods to retrieve logs from containers.
Upvotes: 1
Reputation: 1571
If your application is logging to stdout in docker, then you can read the logs with docker logs
.
For example use docker logs -f container_name
to follow in realtime the logs of your container (replace with your container's name).
Upvotes: 2