log4net学习之一。

it2022-05-09  26

狂晕了。。 在了个例子一会行一会不行。。 请高手指点一二。。呵呵。。 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 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 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/nanshouyong326/archive/2006/12/16/594310.html


最新回复(0)