2

I'm currently working on a requirement to implement logging in multiple projects and require to develop a enterprise level logging application that can be using in n number of projects.

Present Scenario: What currently is happening is for every solution comprises of 3-4 projects, a logging project was developed and Logger class was created there that can be used within the whole solution. Is writes the logs as text file on the C:\ drive. There are around 5 solutions like that where 5 common projects are created and used within.

Suggestion Scenario: I'm thinking of creating a API(web service) either WCF or WebAPI that performs the logging and can be used in all these 5 solutions. The big advantage is the loose coupling of logger from the solution and also a lot of code reduction since no more 5 logging projects are required.
One more requirement to do store logs in the database instead of text files so that in future a Web Application can be developer that communicates to the database and displays the logs instead of manually looking for it inside the text files.

Doubts: Is going with the API way better than the class libraries already created? What about the latency issues as I have to think it the enterprise level. Can I stick with Common project for logging and make it as a .dll that can be referenced in all the 5 solutions. Doing so, I can be able to reduce the 5 Common projects created earlier.

Any suggestions, feedback is highly appreciated for it!

  • 5
    Do you have any requirements that would make reinventing the wheel a good idea? There are so many logging frameworks out there, why don't you pick one of them and implement it across all your solutions? – nvoigt Nov 28 '16 at 7:32
  • 1
    Agreed with nvoigt over here. Log4Net is an example of an excellent logging framework that can be used pervasively in all solutions, has a great API and it's already used as a standard logging framework in many projects. – Machado Nov 28 '16 at 13:03
2

You are re-inventing the wheel here, there are a ton of excellent logging libraries for C#, as well as excellent log aggregation systems. My personal favourite logging library is Serilog, and for log aggregation we use ELK with filebeat. See The Complete Guide to the ELK Stack for a decent overview of ELK.

If you do want to develop your own logging implementation I would advise looking at existing frameworks for insights. Here are a bunch of good open source ones:

0

I recommend not reinventing the wheel here. I do suggest writing a common library to encapsulate your specific requirements such as format, helper methods, container setup, etc. However, I would not get into writing the actual log aggregation service. Depending on the constraints set by your organization you might want to look into cloud based log analysis services such as Loggly or on-premise solutions like the ones Justin suggested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.