log4net学习之一。
狂晕了。。
在了个例子一会行一会不行。。
请高手指点一二。。呵呵。。
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Web.config
1
<?xml version="1.0" encoding="utf-8" ?>
2
<configuration>
3
<configSections>
4
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
5
</configSections>
6
7
<log4net debug="true">
8
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
9
<file value="C:\\TestProj\\TestLog.txt" />
10
<appendToFile value="true" />
11
<rollingStyle value="Size" />
12
<maxSizeRollBackups value="10" />
13
<maximumFileSize value="2KB" />
14
<staticLogFileName value="true" />
15
<layout type="log4net.Layout.PatternLayout">
16
<conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
17
</layout>
18
</appender>
19
20
<root>
21
<level value="DEBUG" />
22
<appender-ref ref="RollingLogFileAppender" />
23
</root>
24
</log4net>
25
26
<system.web>
27
<pages validateRequest="true" />
28
<!-- DYNAMIC DEBUG COMPILATION
29
Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to
30
false will improve runtime performance of this application.
31
Set compilation debug="true" to insert debugging symbols (.pdb information)
32
into the compiled page. Because this creates a larger file that executes
33
more slowly, you should set this value to true only when debugging and to
34
false at all other times. For more information, refer to the documentation about
35
debugging ASP.NET files.
36
-->
37
<compilation defaultLanguage="c#" debug="true" />
38
<!-- CUSTOM ERROR MESSAGES
39
Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
40
Add <error> tags for each of the errors you want to handle.
41![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
42
"On" Always display custom (friendly) messages.
43
"Off" Always display detailed ASP.NET error information.
44
"RemoteOnly" Display custom (friendly) messages only to users not running
45
on the local Web server. This setting is recommended for security purposes, so
46
that you do not display application detail information to remote clients.
47
-->
48
<customErrors mode="Off" />
49
<!-- AUTHENTICATION
50
This section sets the authentication policies of the application. Possible modes are "Windows",
51
"Forms", "Passport" and "None"
52![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
53
"None" No authentication is performed.
54
"Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
55
its settings for the application. Anonymous access must be disabled in IIS.
56
"Forms" You provide a custom form (Web page) for users to enter their credentials, and then
57
you authenticate them in your application. A user credential token is stored in a cookie.
58
"Passport" Authentication is performed via a centralized authentication service provided
59
by Microsoft that offers a single logon and core profile services for member sites.
60
-->
61
<authentication mode="Windows"></authentication>
62
<identity impersonate="true"></identity>
63
<!-- AUTHORIZATION
64
This section sets the authorization policies of the application. You can allow or deny access
65
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
66
(unauthenticated) users.
67
-->
68
<authorization>
69
<allow users="*" /> <!-- Allow all users -->
70
<!-- <allow users="[comma separated list of users]"
71
roles="[comma separated list of roles]"/>
72
<deny users="[comma separated list of users]"
73
roles="[comma separated list of roles]"/>
74
-->
75
</authorization>
76
<!-- APPLICATION-LEVEL TRACE LOGGING
77
Application-level tracing enables trace log output for every page within an application.
78
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
79
trace information will be displayed at the bottom of each page. Otherwise, you can view the
80
application trace log by browsing the "trace.axd" page from your web application
81
root.
82
-->
83
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
84
<!-- SESSION STATE SETTINGS
85
By default ASP.NET uses cookies to identify which requests belong to a particular session.
86
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
87
To disable cookies, set sessionState cookieless="true".
88
-->
89
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
90
cookieless="false" timeout="20" />
91
<!-- GLOBALIZATION
92
This section sets the globalization settings of the application.
93
-->
94
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
95
</system.web>
96
97
<system.diagnostics>
98
<trace autoflush="true">
99
<listeners>
100
<add name="textWriterTraceListener" type="System.Diagnostics.TextWriterTraceListener"
101
initializeData="C:\\TestProj\\TestProjlog4net.txt" />
102
</listeners>
103
</trace>
104
</system.diagnostics>
105
</configuration>
在了个例子一会行一会不行。。
请高手指点一二。。呵呵。。
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
1
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
27
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
28
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
29
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
30
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
31
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
32
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
33
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
34
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
35
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
36
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
37
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
38
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
39
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
40
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
41
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
42
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
43
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
44
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
45
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
46
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
47
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
48
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
49
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
50
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
51
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
52
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
53
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
54
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
55
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
56
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
57
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
58
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
59
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
60
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
61
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
62
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
63
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
64
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
65
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
66
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
67
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
68
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
69
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
70
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
71
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
72
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
73
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
74
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
75
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
76
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
77
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
78
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
79
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
80
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
81
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
82
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
83
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
84
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
85
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
86
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
87
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
88
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
89
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
90
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
91
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
92
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
93
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
94
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
95
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
96
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
97
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
98
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
99
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
100
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
101
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
102
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
103
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
104
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
105
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](http://www.cnblogs.com/images/cnblogs_com/nanshouyong326/90398/o_20080126(020).jpg)