Approach of delivering “Logging API”

I faced a question in a .NET interview.

As a client i need a LoggingAPI. How you go the approach of design and development and delivering Logging API to the client? I don’t care about WPF or a language specific. I want a LoggingAPI which has to log some data? what is your approach in delivering the same.

I failed to answer for this question. Please guide how to proceed for answering this type of questions.

1

The interview question isn’t clear enough. A client needs a logging API to do what? What’s wrong with existent .NET Framework features?

Case 1: they were testing your analysis skills

Maybe they were expecting you to ask those precise questions, the intent being to make sure you have enough experience in elucidating the requirements and understanding the problem, instead of just starting to write code with no thought about the problem itself, like beginners usually do.

As a developer, you’re expected to solve problems and the fastest, less expensive and most elegant way, not to simply type code. When you’re asked to “create a blog engine which could be deployed in LAMP environment”, if your first reflex is to create a new PHP file and to start typing, you’re doing it wrong. Instead, you’re expected to either know or go, search and find that there is already a product called WordPress that you can use, reducing the cost and delivery time, while increasing the final quality.

In real life, it happens like that:

— We need a logging API. What would be your approach of design, development and delivery?
— Wait, why can’t you use log4net?
— Because we don’t want additional libraries [one of the most stupid arguments, but sadly you rarely can reply this to the customer].
— What about .NET Framework logging?
— No. We need something powerful with lots of features.
— Ok. What features do you need which are not already available in .NET Framework?
— We need to be able to save some entries to the Windows Event Log, not simply to text files.
— This is what EventLogTraceListener does.
— Really? I didn’t know that. Well, it’s still not an option, because we need to include, with every trace event, the date and time of the event, as well as some debug values which are in a static class. Those values give us precious information about the state of the system.
— The date and time are added with TraceListener.TraceOutputOptions. As for the additional variables, the most straightforward way would be to extend either the TraceSource or one of the TraceListeners to include the values of those variables.

Case 2: they were checking if you know how logging APIs are done

Maybe they were expecting you to describe the architecture of a logging library. In which case you were expected to tell that it should have:

  • Types (for example verbose, information, warning and error),

  • Listeners; this enables the user to attach one or more listeners like the one which logs the information to a file, or one which outputs it to the console, or one which saves the logs in the database or as Windows Events,

  • Filtering, i.e. each listener may want to listen to the logs from one component of an application, but not another, or a listener may be interested in only errors and warnings, while another one will record everything,

It should also be aware of concurrency issues. Writing logs to the same file from two threads would inevitably cause problems.

Being able to configure different options, especially the log level, at runtime (for example through App.config) is also nice to have.

4

How you go the approach of design and development and delivering Logging API to the client?

The first (and usually only) thought would be to use one of the many mature, tested and well-known existing logging libraries.. As for which one if the client doesn’t care, use what you know best or what seems to be most popular.

This is if it’s supposed to be a real world scenario, which it sounds like when talking about a client. It may be that the interviewers really wanted to test your understanding of how logging APIs are designed, so it might be best to first clarify that.

To gain the undestanding, it would be best to take a look at various logging libraries to see what they have in common. Typical elements are:

  • log levels that allow you to specify how important a log message is and allow the system to log only those above a certain level
  • a way to associate log messsages with modules (or classes, packages, namespaces…) so you can have per-module output and configuration
  • Various logging targets (log to a file, a DB, send emails, etc.)
  • a way to configure all of the above.

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật