Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
488df1b0
Commit
488df1b0
authored
Apr 18, 2018
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add log to samples
parent
68ca54d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
3 deletions
+39
-3
Program.cs
samples/Sample.Kafka.MySql/Program.cs
+6
-1
Sample.Kafka.MySql.csproj
samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj
+6
-0
Startup.cs
samples/Sample.Kafka.MySql/Startup.cs
+1
-2
nlog.config
samples/Sample.Kafka.MySql/nlog.config
+26
-0
No files found.
samples/Sample.Kafka.MySql/Program.cs
View file @
488df1b0
using
Microsoft.AspNetCore
;
using
Microsoft.AspNetCore.Hosting
;
using
NLog.Web
;
namespace
Sample.Kafka.MySql
{
...
...
@@ -14,7 +15,11 @@ namespace Sample.Kafka.MySql
public
static
IWebHost
BuildWebHost
(
string
[]
args
)
=>
WebHost
.
CreateDefaultBuilder
(
args
)
.
UseStartup
<
Startup
>()
.
ConfigureLogging
((
hostingContext
,
builder
)
=>
{
hostingContext
.
HostingEnvironment
.
ConfigureNLog
(
"nlog.config"
);
})
.
UseNLog
()
.
Build
();
}
}
\ No newline at end of file
samples/Sample.Kafka.MySql/Sample.Kafka.MySql.csproj
View file @
488df1b0
...
...
@@ -10,6 +10,7 @@
<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>
...
...
@@ -20,5 +21,10 @@
<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>
</Project>
samples/Sample.Kafka.MySql/Startup.cs
View file @
488df1b0
using
System
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.Extensions.DependencyInjection
;
namespace
Sample.Kafka.MySql
...
...
samples/Sample.Kafka.MySql/nlog.config
0 → 100644
View file @
488df1b0
<?
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}日期:${longdate} 级别:${uppercase:${level}} 用户:${aspnet-user-identity}(${aspnet-request-ip}) 记录器:${logger} ${newline}URL:${aspnet-request-method} ${aspnet-request-url:IncludePort=true:IncludeQueryString=true} ${newline}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
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment