PublishToCommonLogging.patch 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. Index: CassiniDev/CassiniDev.4.csproj
  2. ===================================================================
  3. --- CassiniDev/CassiniDev.4.csproj (revision 70191)
  4. +++ CassiniDev/CassiniDev.4.csproj (working copy)
  5. @@ -74,6 +74,9 @@
  6. <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
  7. </PropertyGroup>
  8. <ItemGroup>
  9. + <Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
  10. + <HintPath>..\packages\Common.Logging.2.0.0\lib\2.0\Common.Logging.dll</HintPath>
  11. + </Reference>
  12. <Reference Include="System" />
  13. <Reference Include="System.configuration" />
  14. <Reference Include="System.Configuration.Install" />
  15. @@ -115,6 +118,12 @@
  16. <Compile Include="Views\BodyView.Designer.cs">
  17. <DependentUpon>BodyView.cs</DependentUpon>
  18. </Compile>
  19. + <Compile Include="Views\HelpView.cs">
  20. + <SubType>Form</SubType>
  21. + </Compile>
  22. + <Compile Include="Views\HelpView.Designer.cs">
  23. + <DependentUpon>HelpView.cs</DependentUpon>
  24. + </Compile>
  25. <Compile Include="Views\FormView.cs">
  26. <SubType>Form</SubType>
  27. </Compile>
  28. @@ -133,6 +142,9 @@
  29. <EmbeddedResource Include="Views\BodyView.resx">
  30. <DependentUpon>BodyView.cs</DependentUpon>
  31. </EmbeddedResource>
  32. + <EmbeddedResource Include="Views\HelpView.resx">
  33. + <DependentUpon>HelpView.cs</DependentUpon>
  34. + </EmbeddedResource>
  35. <EmbeddedResource Include="Views\FormView.resx">
  36. <DependentUpon>FormView.cs</DependentUpon>
  37. </EmbeddedResource>
  38. @@ -164,6 +176,7 @@
  39. <None Include="CassiniDev4.exe.config">
  40. <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  41. </None>
  42. + <None Include="packages.config" />
  43. </ItemGroup>
  44. <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  45. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  46. Index: CassiniDev/CassiniDev.Console4.csproj
  47. ===================================================================
  48. --- CassiniDev/CassiniDev.Console4.csproj (revision 70191)
  49. +++ CassiniDev/CassiniDev.Console4.csproj (working copy)
  50. @@ -79,6 +79,9 @@
  51. <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
  52. </PropertyGroup>
  53. <ItemGroup>
  54. + <Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
  55. + <HintPath>..\packages\Common.Logging.2.0.0\lib\2.0\Common.Logging.dll</HintPath>
  56. + </Reference>
  57. <Reference Include="System" />
  58. <Reference Include="System.configuration" />
  59. <Reference Include="System.Configuration.Install" />
  60. @@ -123,6 +126,7 @@
  61. <None Include="CassiniDev4-console.exe.config">
  62. <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  63. </None>
  64. + <None Include="packages.config" />
  65. </ItemGroup>
  66. <ItemGroup>
  67. <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
  68. Index: CassiniDev/CassiniDev.Lib4.csproj
  69. ===================================================================
  70. --- CassiniDev/CassiniDev.Lib4.csproj (revision 70191)
  71. +++ CassiniDev/CassiniDev.Lib4.csproj (working copy)
  72. @@ -71,6 +71,9 @@
  73. <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
  74. </PropertyGroup>
  75. <ItemGroup>
  76. + <Reference Include="Common.Logging">
  77. + <HintPath>..\packages\Common.Logging.2.0.0\lib\2.0\Common.Logging.dll</HintPath>
  78. + </Reference>
  79. <Reference Include="System" />
  80. <Reference Include="System.configuration" />
  81. <Reference Include="System.Configuration.Install" />
  82. @@ -132,6 +135,7 @@
  83. <None Include="CassiniDev4-lib.dll.config">
  84. <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  85. </None>
  86. + <None Include="packages.config" />
  87. </ItemGroup>
  88. <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  89. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  90. Index: CassiniDev/CassiniDev.VisualStudio44.csproj
  91. ===================================================================
  92. --- CassiniDev/CassiniDev.VisualStudio44.csproj (revision 70191)
  93. +++ CassiniDev/CassiniDev.VisualStudio44.csproj (working copy)
  94. @@ -71,6 +71,9 @@
  95. <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
  96. </PropertyGroup>
  97. <ItemGroup>
  98. + <Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
  99. + <HintPath>..\packages\Common.Logging.2.0.0\lib\2.0\Common.Logging.dll</HintPath>
  100. + </Reference>
  101. <Reference Include="System" />
  102. <Reference Include="System.configuration" />
  103. <Reference Include="System.Configuration.Install" />
  104. @@ -166,6 +169,7 @@
  105. </BootstrapperPackage>
  106. </ItemGroup>
  107. <ItemGroup>
  108. + <None Include="packages.config" />
  109. <None Include="WebDev.WebServer40.exe.config">
  110. <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  111. <SubType>Designer</SubType>
  112. Index: CassiniDev/Core/Server.cs
  113. ===================================================================
  114. --- CassiniDev/Core/Server.cs (revision 70191)
  115. +++ CassiniDev/Core/Server.cs (working copy)
  116. @@ -23,10 +23,12 @@
  117. using System.Runtime.Remoting;
  118. using System.Security.Permissions;
  119. using System.Security.Principal;
  120. +using System.Text;
  121. using System.Threading;
  122. using System.Web;
  123. using System.Web.Hosting;
  124. using CassiniDev.ServerLog;
  125. +using Common.Logging;
  126. #endregion
  127. @@ -452,13 +454,43 @@
  128. {
  129. EventHandler<RequestEventArgs> complete = RequestComplete;
  130. + PublishLogToCommonLogging(requestLog);
  131. + PublishLogToCommonLogging(responseLog);
  132. +
  133. if (complete != null)
  134. {
  135. complete(this, new RequestEventArgs(id, requestLog, responseLog));
  136. }
  137. }
  138. + readonly ILog _logger = LogManager.GetCurrentClassLogger();
  139. + private void PublishLogToCommonLogging(LogInfo item)
  140. + {
  141. + var bodyAsString = String.Empty;
  142. + try
  143. + {
  144. + bodyAsString = Encoding.UTF8.GetString(item.Body);
  145. + }
  146. +// ReSharper disable EmptyGeneralCatchClause
  147. + catch (Exception e)
  148. +// ReSharper restore EmptyGeneralCatchClause
  149. + {
  150. + /* empty bodies should be allowed */
  151. + }
  152. + var type = item.RowType == 0 ? "" : item.RowType == 1 ? "Request" : "Response";
  153. + _logger.Debug(type + " | " +
  154. + item.Created + " | " +
  155. + item.StatusCode + " | " +
  156. + item.Url + " | " +
  157. + item.PathTranslated + " | " +
  158. + item.Identity + " | " +
  159. + "\n===>Headers<====\n" + item.Headers +
  160. + "\n===>Body<=======\n" + bodyAsString
  161. + );
  162. + }
  163. +
  164. +
  165. public void ShutDown()
  166. {
  167. _shutdownInProgress = true;
  168. Index: packages/Common.Logging.2.0.0/Common.Logging.2.0.0.nupkg
  169. ===================================================================
  170. Cannot display: file marked as a binary type.
  171. svn:mime-type = application/octet-stream
  172. Property changes on: packages\Common.Logging.2.0.0\Common.Logging.2.0.0.nupkg
  173. ___________________________________________________________________
  174. Added: svn:mime-type
  175. + application/octet-stream
  176. Index: packages/Common.Logging.2.0.0/lib/2.0/Common.Logging.dll
  177. ===================================================================
  178. Cannot display: file marked as a binary type.
  179. svn:mime-type = application/octet-stream
  180. Property changes on: packages\Common.Logging.2.0.0\lib\2.0\Common.Logging.dll
  181. ___________________________________________________________________
  182. Added: svn:mime-type
  183. + application/octet-stream
  184. Index: packages/repositories.config
  185. ===================================================================
  186. --- packages/repositories.config (revision 0)
  187. +++ packages/repositories.config (revision 0)
  188. @@ -0,0 +1,4 @@
  189. +<?xml version="1.0" encoding="utf-8"?>
  190. +<repositories>
  191. + <repository path="..\CassiniDev\packages.config" />
  192. +</repositories>
  193. \ No newline at end of file