Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Marat Pavlov
/
AlexAdapter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ca48b6e6
authored
Mar 26, 2022
by
Alex Nasyr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
serilog for logging added
parent
066f641d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
SocialMinistryDataExchange/Model/SMRepository.cs
SocialMinistryDataExchange/SocialMinistryDataExchange.csproj
SocialMinistryDataExchange/Startup.cs
SocialMinistryDataExchange/appsettings.json
SocialMinistryDataExchange/Model/SMRepository.cs
View file @
ca48b6e6
...
...
@@ -74,8 +74,8 @@ namespace SocialMinistryDataExchange.Model {
responce_record
=
FormatResponce
(
_contingentContext
,
record
);
}
catch
(
Exception
ex
)
{
_logger
.
LogError
(
$"
{
ex
.
Message
}
,
{
ex
.
TargetSite
.
Name
}
,
{
doc
.
Person
}
"
);
_logger
.
LogInformation
(
$"
c
reating empty person for doc.seria=
{
doc
.
Person
.
PersonDocumentSeria
}
; doc.number=
{
doc
.
Person
.
PersonDocumentNumber
}
"
);
_logger
.
LogError
(
$"
{
ex
.
Message
}
,
{
ex
.
TargetSite
.
Name
}
"
);
_logger
.
LogInformation
(
$"
C
reating empty person for doc.seria=
{
doc
.
Person
.
PersonDocumentSeria
}
; doc.number=
{
doc
.
Person
.
PersonDocumentNumber
}
"
);
responce_record
=
FormatResponce
(
_contingentContext
,
new
SMResponceTemp
()
{
rowguid_eais
=
doc
.
Person
.
rowguid_eais
,
СерияДокумента
=
doc
.
Person
.
PersonDocumentSeria
,
НомерДокумента
=
doc
.
Person
.
PersonDocumentNumber
});
}
...
...
SocialMinistryDataExchange/SocialMinistryDataExchange.csproj
View file @
ca48b6e6
...
...
@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Extensions.Logging.File" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.9" />
...
...
SocialMinistryDataExchange/Startup.cs
View file @
ca48b6e6
...
...
@@ -4,9 +4,12 @@ using Microsoft.EntityFrameworkCore;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.OpenApi.Models
;
using
SocialMinistryDataExchange.Model
;
using
SocialMinistryDataExchange.Model.DB.Center
;
using
System
;
using
System.IO
;
namespace
SocialMinistryDataExchange
{
public
class
Startup
{
...
...
@@ -31,7 +34,7 @@ namespace SocialMinistryDataExchange {
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public
void
Configure
(
IApplicationBuilder
app
,
IWebHostEnvironment
env
)
{
public
void
Configure
(
IApplicationBuilder
app
,
IWebHostEnvironment
env
,
ILoggerFactory
loggerFactory
)
{
if
(
env
.
IsDevelopment
())
{
app
.
UseDeveloperExceptionPage
();
app
.
UseSwagger
();
...
...
@@ -47,6 +50,8 @@ namespace SocialMinistryDataExchange {
app
.
UseEndpoints
(
endpoints
=>
{
endpoints
.
MapControllers
();
});
loggerFactory
.
AddFile
(
$@"
{
Directory
.
GetCurrentDirectory
()}
\Logs\
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)}
.log"
);
}
}
}
SocialMinistryDataExchange/appsettings.json
View file @
ca48b6e6
...
...
@@ -2,8 +2,8 @@
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Information"
,
"Microsoft"
:
"Warning"
,
"Microsoft.Hosting.Lifetime"
:
"Information"
//
"Microsoft"
:
"Warning"
,
//
"Microsoft.Hosting.Lifetime"
:
"Information"
}
},
"AllowedHosts"
:
"*"
,
...
...
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