log4net adapter

Apache log4Net library represents a tool which helps the programmers to output log statements to a variety of output targets.

KissLog provides log4net integration, which allows developers to save log4net messages to KissLog.net cloud.

Before starting, please make sure that KissLog has been installed by following the Install Instructions.


1. Install NuGet Package

Install NuGet package KissLog.Adapters.log4net

PM> Install-Package KissLog.Adapters.log4net

2. Update log4net config

Note: Depending on the project, log4net configuration can be found either on a stand-alone file, like log4net.config, or can be found inside web.config.

    <level value="ALL" />
    <appender-ref ref="KissLog" />
  <appender name="KissLog" type="KissLog.Adapters.log4net.KissLogAppender, KissLog.Adapters.log4net">
    <layout type="log4net.Layout.SimpleLayout"></layout>

3. Testing integration

At this point, all the log messages captured by log4net.ILog logger will be also sent to all KissLog logs output.

namespace Samples.Log4NetAdapter.Controllers
    public class HomeController : Controller
        private readonly log4net.ILog _logger;
        public HomeController()
            _logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        public ActionResult About()
            ViewBag.Message = "Your application description page.";

            _logger.Debug("Hello world from Log4Net!");


            _logger.Info(new { Id = 10, Price = 100.4M, Name = "Product 1" });

            return View();

log4net on KissLog cloud