Asp.Net 5 (core) RC1: How to log to file (rolling file logging) [DNX Core 5 compatible solution]? -


how can log file in asp.net 5 rc1? couldn't find solution microsoft.extensions.logging. there solution compatible .net core 5 (dnx core 5.0)? trying use serilog serilog doesn't support core 5 yet.

to use serilog in asp.net 5 rc1 project, add following dependencies in project.json file:

"serilog.extensions.logging": "1.0.0-rc1-final-10092", "serilog.sinks.rollingfile": "2.0.0-beta-465" 

create logger in startup constructor:

public startup(iapplicationenvironment appenv) {     log.logger = new loggerconfiguration()         .minimumlevel.debug()         .writeto.rollingfile(path.combine(appenv.applicationbasepath, "log-{date}.txt"))         .createlogger(); } 

and add serilog in startup.configure method:

public void configure(iapplicationbuilder app, iloggerfactory loggerfactory) {     loggerfactory.addserilog(); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -