• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Application Logging Methods and Techniques

clamum

Lifer
I did a search and didn't really see much about this so I thought I'd start a new thread.

What do you guys use to handle your logging needs/requirements when designing and working with applications? I know of Log4net but I don't have any experience with it beyond previous co-workers saying it was good.

At my current job, logging is done by a custom class library that writes out the appropriate info to a text file on disk. It has support for multiple severity levels and can also send out emails to specific users, depending on the error and severity. It works well enough but we're looking to "upgrade" at some point so I was wondering what you guys have used or recommend.
 
It depends quite a bit on the scenario. In a simple scenario I use the python logging module, which supports file rotation and syslog and a few other sinks.

For event collection in a distributed system we use redis as an event sink, logstash to pull the events and parse them, elasticsearch to index and store them, and kibana to view them.
 
If you are thinking about log4net then I assume you are using .Net. .Net has builtin logging using the System.Diagnostics.Trace namespace and tracelisteners.
The benefit of the builtin framework is you can add EventLog, TextFile or Database log writers to your app, just by making changes to the .config file .

http://www.daveoncsharp.com/2009/09/create-a-logger-using-the-trace-listener-in-csharp/

There is not a builtin email trace listener, but you can create your own. Here is an example EMailTraceListener:

http://www.codeproject.com/Articles/3581/How-to-create-an-SMTP-Trace-Listener
 
At where I work we use Log4net. It works for us. We log all transactions from our application to other groups and back. It has been good to show that errors are occurring outside our code.
 
We use Log4J where I work. By configuring appenders in various ways, we've been able to make it fit all our logging needs. I assume Log4net is the same thing.
 
Ah yes KB, I forgot to mention that I work in a .NET environment. Well, the small team I'm on is up to .NET 4.5.1 and VStudio 2013; we also have a VB6 team and lots of VB6 software around too.

I do know there's built-in logging in the .NET framework but beyond that I haven't really used it I guess. I also know of the logging module in the Enterprise Library (I think that's it) but again, no experience with that beyond using the Data Access module a little bit years ago at a job.
 
I work with Java and use slf4j with logback as implementation.

slf4j is a logging facade. So if you create a library you use this and the user of your library can then choose his own implementation (usually logback for new stuff and log4j for legacy). If no implementation is present, no logging is done.

Of course you get different log levels and can configure how it is logged (file, console and formatting like datetime).

EDIT:

I would avoid a custom made solution at all costs. It only adds maintenance cost and will almost certainly have less features than proven solutions.
 
I would avoid a custom made solution at all costs. It only adds maintenance cost and will almost certainly have less features than proven solutions.
I agree. But they're leary of using open source software here since it can be difficult to get support if there's a bug that is found. If we find a critical bug, we need to be able to call the company that develops the software and figure something out. I'm definitely a supporter of open source stuff like log4net or whatever, but I can see my job's point of view as well.
 
I agree. But they're leary of using open source software here since it can be difficult to get support if there's a bug that is found. If we find a critical bug, we need to be able to call the company that develops the software and figure something out. I'm definitely a supporter of open source stuff like log4net or whatever, but I can see my job's point of view as well.

Let's be honest here. I have yet to met usable support. for proprietary products In fact the best support I usually get from Open Source backed by a corporation. eg. stuff in hibernate and spring is usually fixed rather quickly if it is critical and you can go and file a bug report. Doesn't cost you anything.

Now for established libraries used often around the globe I doubt you will found a bug. And if it really is that critical and crucial you should get the time and money to fix the bug yourself. This is not possible with proprietary products. I mean you will have bugs in your home-grown stuff too and almost certainly more while having less features. No it makes no sense.

A software company we get software from built their home-grown bug-tracking. It was terrible and the once told us it took away 2 developer jobs from doing their actually work.
 
Let's be honest here. I have yet to met usable support. for proprietary products In fact the best support I usually get from Open Source backed by a corporation. eg. stuff in hibernate and spring is usually fixed rather quickly if it is critical and you can go and file a bug report. Doesn't cost you anything.

Now for established libraries used often around the globe I doubt you will found a bug. And if it really is that critical and crucial you should get the time and money to fix the bug yourself. This is not possible with proprietary products. I mean you will have bugs in your home-grown stuff too and almost certainly more while having less features. No it makes no sense.

A software company we get software from built their home-grown bug-tracking. It was terrible and the once told us it took away 2 developer jobs from doing their actually work.

My experience with open source communities is exactly the opposite of what you just said. No one is obligated or even compelled to help beyond their own self motivation which is directly impacted by their personal life. For simple issues, the response time is probably faster, but simple issues also don't usually hold up a project. If you need constant help, you really need to interact with a human being on the phone, in person, or at least instant messenger. Good luck getting someone's time to do that if you aren't paying for it.

I can pick up the phone right now and get to Microsoft tech support level 2 or higher and talk to an actual programmer who can give me an answer with little to no delay about basically any Microsoft product, language, or library. I've done it many, many times. That support call may or may not cost money, but it all depends on your needs. If you have time to wait, then post on a forum and a helpful person will probably see it at some point. If you're running a multi-million dollar business, $100 for an immediate answer that would have otherwise taken days is meaningless.

The methodology you're espousing is clearly biased in support of open source, but I find it to be completely unfounded. There are advantages to both open source software and proprietary software. A smart programmer knows when to use each to solve a problem in the most efficient manner possible. Dismissing one or the other or making blanket statements about superiority doesn't help anyone.

In response to the OP, I use Log4net with a database as the target. I love databases, so I tend to overuse them.
 
I work in a Java environment, which is really unfortunate because I vastly prefer .NET. You can call me a Microsoft fanboy, if you'd like.

Anyway, whether you use Log4Net or carrier pidgins, that's besides the point I'm trying to make. The important thing is that you look into Splunk. You'll be glad you did, trust me. 🙂
 
Back
Top