Solved

What is the benefit of logging libraries?

Posted on 2014-12-03
3
154 Views
Last Modified: 2014-12-04
Hello,

My question is very open ended; basically, why were logging libraries created? For the sake of discussion I'd just like to talk about Java.

What magical things do logging libraries do, that a class with static file objects won't let us do?

Far as I can see, logging libraries are just another dependency in Maven that can cause a build to fail.

I'll admit I'm fairly inexperienced, so I might be missing something obvious... I would be grateful to learn their importance.

Thanks in advance!
0
Comment
Question by:Errang Genevre
3 Comments
 
LVL 26

Accepted Solution

by:
dpearson earned 250 total points
ID: 40480096
The basic ideas behind a logging library are:
 - Support different levels of logging (INFO, ERROR etc.)
 - Support configuration to control what is logged (so you can see just ERROR and then turn it up to DEBUG for details etc.)
 - Separate the code that creates a log from caring where that log is written to (console, file, network stream etc.)
 - Allow logs to be sent to multiple locations without adding multiple log statements (e.g. console and file)
 - Allow filtering so that only certain components are logged in detail, while others are logged at only a high level
 - Do all of this efficiently

Could you build all of that yourself?  Yes of course, but why take the time, just use a library.  They pretty much all support everything above with small differences.

Hope that helps,

Doug
0
 
LVL 37

Assisted Solution

by:Neil Russell
Neil Russell earned 250 total points
ID: 40480177
They serve the same purpose as any other Library.  They give you a standard, tried and tested, set of functions that will perform the same task wherever you use it with minimal coding from you.

Do you use a database? Yes we all do, did you write the database every time you want to use one? No of course not, you use a standard database backend that has a standard method of connecting to it.  Same thing.

It saves time and effort.

"....that can cause a build to fail"   Really? Then you are doing something else wrong and maybe that is what you should be addressing OR you are using a library hat is not robust or fit for purpose.
0
 

Author Closing Comment

by:Errang Genevre
ID: 40480567
Thanks, it's not related to a project I'm working on now; those libraries usually failed for me in the past. And I just thought they were overkill.

But yes, I'll have to accept the argument for consistency.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question