c# - Can't set ASP.NET Core console logging below Information -
i can't seem debug or trace statements displayed in console.
in startup.cs
configure(...)
have:
loggerfactory .withfilter( new filterloggersettings { {"assettrader", loglevel.debug}, {"microsoft", loglevel.warning}, {"system", loglevel.warning}, }) .addconsole();
in controller action have:
this._logger.logtrace("trace"); this._logger.logdebug("debug"); this._logger.loginformation("info"); this._logger.logwarning("warn");
but console output shows 2 entries:
info: assettrader.controllers.homecontroller[0] info warn: assettrader.controllers.homecontroller[0] warn
i have tried loggerfactory.addconsole(loglevel.debug)
, same result.
gist of simple test project reproduce issue: https://gist.github.com/modo-lv/66e3209f89e986423397928630ba5f9a
solved, tseng's comment , answer here.
in case, removing
loggerfactory .withfilter( new filterloggersettings { {"assettrader", loglevel.debug}, {"microsoft", loglevel.warning}, {"system", loglevel.warning}, }) .addconsole();
from configuration(..)
, adding
services.addlogging( builder => { builder.addfilter("assettrader", loglevel.debug) .addfilter("microsoft", loglevel.warning) .addfilter("system", loglevel.warning) .addconsole(); });
to configureservices(...)
solved problem.
Comments
Post a Comment