Click here to Skip to main content
Click here to Skip to main content

LoggingBehavior - How to Connect Log-prints with the WCF Operation's Details, using a Simple Behavior

By , 27 Sep 2011
 
WcfLogPrints_Demo.zip
WcfLogPrints_Demo
Client
Example.Client.exe
Example.Client.pdb
Example.Contracts.dll
Example.Contracts.pdb
Server
Example.Contracts.dll
Example.Contracts.pdb
Example.Server.exe
Example.Server.pdb
Example.Services.dll
Example.Services.pdb
WcfLogPrints.dll
WcfLogPrints.pdb
WcfLogPrints_src.zip
WcfLogPrints
Example.Client
bin
Debug
Properties
Example.Contracts
bin
Release
Properties
Example.Server
bin
Debug
Properties
Example.Services
bin
Release
Properties
WcfLogPrints.suo
WcfLogPrints
bin
Release
Properties
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Example.Contracts;
using WcfLogPrints;

namespace Example.Services
{
    [LoggingBehavior]
    public class MyService : IMyService
    {
        public int MyOperation(int myArg, List<Family> families, out string myResult)
        {
            myResult = "There are " + families.Count + " families.";

            return 5;
        }

        [LoggingBehavior(LogBeforeCall = false)]
        public int MySecondOperation(int myArg)
        {
            return 10;
        }

        public void MyThirdOperation(int i)
        {
            LoggingContext.Current.LogInformation("In MyThirdOperation");

            MyClass c = new MyClass();
            c.MyMethod();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of use and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Shmuel Zang
Software Developer
Israel Israel
Member
MCPD: Web Developer 3.5
MCTS: Windows Presentation Foundation 3.5
MCTS: Windows Communication Foundation 3.5

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 27 Sep 2011
Article Copyright 2011 by Shmuel Zang
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid