-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlog4net.config
54 lines (53 loc) · 2.39 KB
/
log4net.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<!--<appender name="JsonFileAppender" type="log4net.Appender.FileAppender">
<file value="Log/log.json" />
<layout type="OnlineStore.Core.CrossCuttingConcerns.Logging.Log4Net.Layouts.JsonLayout" />
</appender>-->
<appender name="JsonFileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="Log/.json" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="yyyy/MM/yyyy-MM-dd/yyyy-MM-dd-HH-00" />
<maximumFileSize value="100MB" />
<preserveLogFileNameExtension value="true"/>
<staticLogFileName value="false" />
<layout type="OnlineStore.Core.CrossCuttingConcerns.Logging.Log4Net.Layouts.JsonLayout"/>
</appender>
<appender name="SqlServerAppender" type="log4net.Appender.AdoNetAppender">
<bufferSize value="1" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionString value="Data Source=.;Initial Catalog=Store;Integrated Security=True;MultipleActiveResultSets=True" />
<commandText value="INSERT INTO Logs ([Detail],[Date],[Audit]) VALUES (@logDetail,@log_date,@audit)" />
<parameter>
<parameterName value="@logDetail" />
<dbType value="String" />
<size value="4000" />
<layout type="OnlineStore.Core.CrossCuttingConcerns.Logging.Log4Net.Layouts.JsonLayout" />
</parameter>
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.PatternLayout" value="%date{dd'-'MM'-'yyyy HH':'mm':'ss'.'fff}" />
</parameter>
<parameter>
<parameterName value="@audit" />
<dbType value="String" />
<size value="50" />
<layout type="log4net.Layout.PatternLayout" value="%level" />
</parameter>
</appender>
<logger name="JsonFileLogger">
<level value="ALL" />
<appender-ref ref="JsonFileAppender" />
</logger>
<logger name="DatabaseLogger">
<level value="All" />
<appender-ref ref="SqlServerAppender" />
</logger>
</log4net>
</configuration>