Step 3
All your logging facility is stored on the web.config
file. Now right click on the tree , click new and click logging application
block menu.

Figure: - Add logging application block
Step 4
By default the logging utility logs to event logs. So
you will see in the trace listeners a event log trace listeners already added.
Click on the event log trace listeners and specify the machine name. Currently
my machine name is HP.

Figure:- Specify machine name
Step 5
Now that we have defined the necessary configuration
using the logging enterprise tool. It’s time to call the same in the code. So we
add the Enterprise logging application DLL , add the logging namespace , create
object of ‘logentry’ object and finally log the message using the logger
DLL.

Figure: - Use the logging application block
Now if you run the program and click the button you
should see the message logged in event viewer. To view event viewer click on
start , run and type eventvwr.

Figure: - Logged in the event viewer
|