see these Related topics:
- Multi tier basics
- A best practice for multi tier architecture
- A sample code based on best practice
- Examine utilities to speed up Multi tier programming- NLog
Please download the second version of Multi tier code
In previous lessons I talked about basic concepts of Multi tier and a best practice Architecture. Also I examine a sample code about that Architecture in this lesson I am going to review ”NLOG” one of the best tools that with no doubt you better use in that architecture to Log both errors and interaction with application.
What is NLOG?
NLOG is a free tool could be used to log into different resources like file, event viewer, database, Memory, Console, MSMQ, Mail and Web Service and etc. Meanwhile it can be configured to different level of log. Moreover, it can be switched off or on. Also you can have different source of log. Above of all it is open source application. Should you need any changes you will be able to make it.
How NLOG works?NLog gives you a class library to call its services. Also it has a configuration file called NLog.config where you set which log sources you need for instance file or database. Also you can configure the source for example for a file you probably configures the file name. You can have multiple sources. Take look at this sample:
It you look at the rules tag you will find two logger tags where you define each one of these logger
1- which class will represents them (“name”)
2- what is the minimum level of log also you can disable log by setting this value to debug for a release version of application (“minLevel”)
3- Which target this logger is using to log information
Please see the next version of multi tier code with logging
I remind you that I used very simple logging here you may change it and adapt it to your requirements. So this is not a best practice however, it is a good practice using Nlog in your projects. Nlog is really a lot more than I show you here. If you need any extra information or you think it is worth to have more detail information about NLOG let me know and raise some comments here. Do not underestimate this fabulous tool. I believe it needs at least 20 posts to show its capability!
In next lesson I am going to talk about my favourite tool Code Smith to generate code. Please download the next version of the code.
4 comments:
Dear Emad,
Thank you for being such a great teacher. I really enjoy being here. The skills and knowledge I gain will surely help me in my career. I'm most eager for your posts about Multi Tier and distributed Architecture and their utilities. I'll be so happy if you write more. I want to know if its possible to introduce me some more resources to study based on your experiments there, hopefully I'll be there next year and I like to get more ready and I'm needy for your advice.
Thanks again for your wonderful teaching.
Dear Emad i surprised and glad when see you there! I'm Ehsan's friend (Shalchian) and heard about you when he was in Iran. First tanks for teaching and I hope you to enjoy your life.
I want to use The NLOG in our project but i couldn't find it free! and if it's possible for you please talk more about enterprise software Architecure.
Thanks again
Dear Emad i surprised and glad when see you there! I'm Ehsan's friend (Shalchian) and heard about you when he was in Iran. First tanks for sharing your experience and I hope you to continue your teching not like to Ehsan ;)
I want to use The NLOG in our project but i couldn't find it free! and if it's possible for you please talk more about enterprise software Architecure.
Thanks again
Post a Comment