log4net

Not gonna lie- it wasn’t altogether _that_ intuitive to begin with. Appenders, logging levels, loggers and a whole bunch of different configuration going on: it wasn’t just working. But, i thought to myself: many others are happy with it so it must be worth the initial pain. Of course, in a world of instant gratification and high-speed demands, how long exactly do you sit with a problem?

If it’s a maths problem, like something involving integrals, sometimes you can do nothing but sit with it. No amount of Google is ever gonna give you the answer. And if you think it can, i’ll happily take on the challenge 🙂 But this is code…

CodeBetter, CodeProject, Koders and even log4Net itself have plenty of sample code and tutorials designed to get you off the ground. And they all have their strong points so if you thinking about log4net, take some time upfront just to read how different people go about explaining various setups and configurations. You’re bound to find one you like. So back to this particular log4net experience…

What i wanted is to have an open console running which recorded anything i wanted while my asp.net application was executing. i love consoles ‘cos of their simplicity, power, flexibility and in-obtrusiveness. in the right place, at the right time, they definitely rock. So that’s the mission.

There’s this article which gave me a great jump start in the right direction. I made a few modifications (i am programmer) and as a result… well, this picture is worth a paragraph or two:

log4net console
More than anything, this is testimony that log4net really does work despite some of the comments and posts (and initial pain) and once you’ve got it down, you can add massive geek-value to your project. You also just might have fun, but keep that to yourself 😉

3 replies on “log4net”

If it’s any help, I wrote a few posts on Log4Net that many have found useful.

http://haacked.com/archive/2005/03/07/ConfiguringLog4NetForWebApplications.aspx

Including a troubleshooting post:
http://haacked.com/archive/2006/09/27/Log4Net_Troubleshooting.aspx

For fun, see log4net events in realtime with Chainsaw: http://geekswithblogs.net/kobush/archive/2005/07/15/46627.aspx

I just recently joined Koders and was searching around to see what blogs were mentioning it when I found this post. I realized it wasn’t about Koders, but it *was* about Log4Net, which I really like (and have submitted patches to). 😉

I’m currently working on a Chainsaw alternative, developped in C# 2.0, called Log2Console, with a simple but nice GUI. It’s still a beta version but it’s functional. Currently the available receivers are: Remoting, File and UDP.

The logger hierarchy is displayed in a tree view, and it’s possible to deactivate each of them. You can also filter according to the log level and the UI is customizable.

The project is hosted on CodePlex (a great service!!), the current release and the sources are available here: http://www.codeplex.com/log2console

You may want to give a try, your feedback is welcome!

Comments are closed.