Skip to content

KissLog for Web applications

Catalin Gavan edited this page Nov 16, 2021 · 6 revisions

For web applications, KissLog creates and shares the same logger instance throughout the entire http request (connection).

Logger must be resolved using Logger.Factory.Get() factory method.

public class HomeController : Controller
{
    public ActionResult Index()
    {
        var logger = Logger.Factory.Get();
        logger.Trace("Hey there!");

        return View();
    }
}

Logger will be flushed automatically at the end of the http request, therefore there is no need to explicitly call Logger.NotifyListeners().

HTTP properties