Kirill Mehtiev
Kirill Mehtiev

Reputation: 15

How to use built-in logging in dnx?

Is it possible to use built-in logging to file in dnx? I tried to use System.Diagnostics.TextWriterTraceListener but is not available in .Net Core. Any suggestions?

Upvotes: 1

Views: 218

Answers (1)

poke
poke

Reputation: 387647

By itself, ASP.NET Core’s logging system does not come with a file-based logging provider.

It would be pretty simple to roll your own though; just look at the Debug logger as an example to see what you need to do.

Of course, you could also use another logging framework that already supports this. For example NLog – a .NET Core compatible version is in alpha. Another example would be Serilog which also has .NET Core versions in beta (versions 2.x)

If you run your app through IIS, you can also use IIS’ file logging to redirect the stdout logging into files. This can be configured in the web.config.

Upvotes: 1

Related Questions