Click here to Skip to main content
12,454,965 members (55,251 online)
Click here to Skip to main content

Tagged as

Stats

53.6K views
1.6K downloads
73 bookmarked
Posted

Mini Drop-in Replacement for log4net

, 4 May 2012 CPOL
Mini drop-in replacement for log4net
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using log4net;

namespace mylogger
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        ILog _log = LogManager.GetLogger(typeof(Form1));

        private void Form1_Load(object sender, EventArgs e)
        {
            LogManager.Configure("logs\\log.txt", 1000, false);
            _log.Debug("sdasdasd");
            _log.Error("hello", new Exception("asdasd"));
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Random r = new Random();
            for (int i = 0; i < 100; i++)
                _log.Info("hello " + i + " " + r.Next(100000));
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (progressBar1.Value < progressBar1.Maximum)
                progressBar1.Value++;
            else
                progressBar1.Value = 0;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Mehdi Gholam
Architect -
United Kingdom United Kingdom
Mehdi first started programming when he was 8 on BBC+128k machine in 6512 processor language, after various hardware and software changes he eventually came across .net and c# which he has been using since v1.0.
He is formally educated as a system analyst Industrial engineer, but his programming passion continues.

* Mehdi is the 5th person to get 6 out of 7 Platinum's on Code-Project (13th Jan'12)
* Mehdi is the 3rd person to get 7 out of 7 Platinum's on Code-Project (26th Aug'16)

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 5 May 2012
Article Copyright 2010 by Mehdi Gholam
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid