浏览代码

update sample.

master
Savorboard 6 年前
父节点
当前提交
05852ee511
共有 7 个文件被更改,包括 12 次插入100 次删除
  1. +1
    -1
      build/version.props
  2. +1
    -7
      samples/Sample.Kafka.MySql/Program.cs
  3. +5
    -15
      samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj
  4. +0
    -26
      samples/Sample.Kafka.MySql/nlog.config
  5. +1
    -7
      samples/Sample.RabbitMQ.MySql/Program.cs
  6. +4
    -18
      samples/Sample.RabbitMQ.MySql/Sample.RabbitMQ.MySql.csproj
  7. +0
    -26
      samples/Sample.RabbitMQ.MySql/nlog.config

+ 1
- 1
build/version.props 查看文件

@@ -2,7 +2,7 @@
<PropertyGroup>
<VersionMajor>2</VersionMajor>
<VersionMinor>2</VersionMinor>
<VersionPatch>2</VersionPatch>
<VersionPatch>3</VersionPatch>
<VersionQuality></VersionQuality>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
</PropertyGroup>


+ 1
- 7
samples/Sample.Kafka.MySql/Program.cs 查看文件

@@ -1,6 +1,5 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using NLog.Web;

namespace Sample.Kafka.MySql
{
@@ -14,12 +13,7 @@ namespace Sample.Kafka.MySql

public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, builder) =>
{
hostingContext.HostingEnvironment.ConfigureNLog("nlog.config");
})
.UseNLog()
.UseStartup<Startup>()
.Build();
}
}

+ 5
- 15
samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj 查看文件

@@ -1,30 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>Sample.Kafka.MySql</AssemblyName>
<WarningsAsErrors>NU1701</WarningsAsErrors>
<NoWarn>NU1701</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
<PackageReference Include="MySqlConnector" Version="0.38.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.5.2" />
<PackageReference Include="zipkin4net" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="MySqlConnector" Version="0.40.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\DotNetCore.CAP.Kafka\DotNetCore.CAP.Kafka.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP.MySql\DotNetCore.CAP.MySql.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP\DotNetCore.CAP.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</ItemGroup>

</Project>

+ 0
- 26
samples/Sample.Kafka.MySql/nlog.config 查看文件

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="logs/internal-nlog.txt">

<variable name="myLogLayout"
value="---------------------------------------------------------------------------${newline}Date:${longdate} Level:${uppercase:${level}} User:${aspnet-user-identity}(${aspnet-request-ip}) Logger:${logger} URL:${aspnet-request-method} ${aspnet-request-url:IncludePort=true:IncludeQueryString=true} Action:${aspnet-mvc-action} ${newline}Message:${message} ${newline}${onexception:Exception:${exception:format=toString}}" />
<extensions>
<add assembly="NLog.Web.AspNetCore" />
</extensions>

<!-- define various log targets -->
<targets>
<!-- write logs to file -->
<target name="allfile" xsi:type="File" fileName="logs/cap-all-${shortdate}.log"
layout="${myLogLayout}" />
</targets>

<rules>
<!--All logs, including from Microsoft-->
<logger name="*" minlevel="Debug" writeTo="allfile" />
</rules>
</nlog>

+ 1
- 7
samples/Sample.RabbitMQ.MySql/Program.cs 查看文件

@@ -1,6 +1,5 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using NLog.Web;

namespace Sample.RabbitMQ.MySql
{
@@ -13,12 +12,7 @@ namespace Sample.RabbitMQ.MySql

public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, builder) =>
{
hostingContext.HostingEnvironment.ConfigureNLog("nlog.config");
})
.UseNLog()
.UseStartup<Startup>()
.Build();
}
}

+ 4
- 18
samples/Sample.RabbitMQ.MySql/Sample.RabbitMQ.MySql.csproj 查看文件

@@ -1,31 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;1705;3277;</NoWarn>
<WarningsAsErrors>NU1605;MSB3277</WarningsAsErrors>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.0.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.5.2" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.0-rc1-final" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\DotNetCore.CAP.MySql\DotNetCore.CAP.MySql.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP.RabbitMQ\DotNetCore.CAP.RabbitMQ.csproj" />
<ProjectReference Include="..\..\src\DotNetCore.CAP\DotNetCore.CAP.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>

+ 0
- 26
samples/Sample.RabbitMQ.MySql/nlog.config 查看文件

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="logs/internal-nlog.txt">

<variable name="myLogLayout"
value="---------------------------------------------------------------------------${newline}Date:${longdate} Level:${uppercase:${level}} User:${aspnet-user-identity}(${aspnet-request-ip}) Logger:${logger} URL:${aspnet-request-method} ${aspnet-request-url:IncludePort=true:IncludeQueryString=true} Action:${aspnet-mvc-action} ${newline}Message:${message} ${newline}${onexception:Exception:${exception:format=toString}}" />
<extensions>
<add assembly="NLog.Web.AspNetCore" />
</extensions>

<!-- define various log targets -->
<targets>
<!-- write logs to file -->
<target name="allfile" xsi:type="File" fileName="logs/cap-all-${shortdate}.log"
layout="${myLogLayout}" />
</targets>

<rules>
<!--All logs, including from Microsoft-->
<logger name="*" minlevel="Debug" writeTo="allfile" />
</rules>
</nlog>

正在加载...
取消
保存