2011-06-22 7 views
1

レガシーasp.netプロジェクトを変更しています。いくつかの名前空間、クラス、およびメソッドに透過的なロギングを含める必要があります。EntLibを使用したASP.NETの透過的なログ

私はEntLibを使用します。私のアプリケーションに透過的なログを記録するためにPolice Injection Settingsを設定できますか?特定の名前空間にすべてのメソッドを記録するために必要なことは何ですか?

これは私のweb.configの一部です。

<policyInjection> 
<policies> 
    <add name="Policy"> 
    <matchingRules> 
     <add type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.MatchingRules.NamespaceMatchingRule, Microsoft.Practices.EnterpriseLibrary.PolicyInjection, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
     name="Namespace Matching Rule"> 
     <matches> 
      <add match="MyNamespace.*" ignoreCase="true" /> 
     </matches> 
     </add> 
    </matchingRules> 
    <handlers> 
     <add type="Microsoft.Practices.EnterpriseLibrary.Logging.PolicyInjection.LogCallHandler, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
     beforeMessage="+++AOP " afterMessage=" AOP+++" name="Logging Call Handler"> 
     <categories> 
      <add name="General" /> 
     </categories> 
     </add> 
    </handlers> 
    </add> 
</policies> 

+0

、誰もが、応答があります

<type type="IMyService" mapTo="MyService"> <lifetime type="singleton"/> <interceptor type="InterfaceInterceptor"/> <policyInjection/> </type> 

また、この本sectionExtension登録を追加する必要があります –

答えて

0

あなたはMYNAMESPACEでクラスを作成して注入するユニティを使用していますか?その場合は、マッピングセクションに要素を追加してみてください。

<sectionExtension type="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, Microsoft.Practices.Unity.Interception.Configuration"/> 
関連する問題