Integrating WCF and logging application block

Topics: Enterprise Library Core, Logging Application Block
Mar 18, 2009 at 10:54 AM
hi,
 
I require to integrate the WCF service application with Enterprise Library 4.1's Logging application block. In general, the runtime exceptions are able to capture n log in this block. but the problem is when it comes to custom messages to be logged like before starting any task in the WCF service method, like shown below:

public void performSomeWCFAction()

        {

                Logger.Write("Method Started");


                // Process student

                Logger.Write("Method Ended");

       }


Control is going to logger.write by the above statement but nothing is actually logged whereas same code works in normal Web app.

Any help will be appreciated.

-/ Rupanshu
Mar 18, 2009 at 11:15 AM
Please refer to the steps provided in the documentation...
http://msdn.microsoft.com/en-us/library/dd203259.aspx


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com
Mar 18, 2009 at 1:47 PM
I followed all tthe steps mentioned in the above link and able to log the runtime exception but the issue is not able to log custom messages under WCF service method which i explained in my previous thread.


-/ Rupanshu
Mar 23, 2009 at 8:54 AM
Sorry for the late response. As I've noticed in the code snippet that you've provided, you never explicitly pass the Category of the Log, which probably mean you are logging to the Default Category. What trace listeners are there in your default category? can you verfiy that there is a default category defined in your logging application block in your config.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Mar 23, 2009 at 12:19 PM
Yes default category is added into my logging application block, i am using Rolling flat file trace listener.
And also can we use the the single log file to log information for different modules in a project. Like i am using WCFservice project and Web proj.
Mar 24, 2009 at 3:49 AM
I created a wcf service and a client.  I was able to write logs from my wcf service.  Could you check if there is an error in the event viewer?


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com