| 发表于:2007-01-31 00:22:55 楼主 |
1,设置了web.congig <?xml version= "1.0 " encoding= "utf-8 " ?> <configuration> <configsections> <section name= "log4net " type= "log4net.config.log4netconfigurationsectionhandler, log4net " /> </configsections> <system.web> <!-- dynamic debug compilation set compilation debug= "true " to enable aspx debugging. otherwise, setting this value to false will improve runtime performance of this application. set compilation debug= "true " to insert debugging symbols (.pdb information) into the compiled page. because this creates a larger file that EXECutes more slowly, you should set this value to true only when debugging and to false at all other times. for more information, refer to the documentation about debugging asp.net files. --> <compilation defaultlanguage= "c# " debug= "true " /> <!-- custom error messages set customerrors mode= "on " or "remoteonly " to enable custom error messages, "off " to disable. add <error> tags for each of the errors you want to handle. "on " always display custom (friendly) messages. "off " always display detailed asp.net error information. "remoteonly " display custom (friendly) messages only to users not running on the local web server. this setting is recommended for security purposes, so that you do not display application detail information to remote clients. --> <customerrors mode= "remoteonly " /> <!-- authentication this section sets the authentication policies of the application. possible modes are "windows ", "forms ", "passport " and "none " "none " no authentication is performed. "windows " iis performs authentication (basic, digest, or integrated windows) according to its settings for the application. anonymous access must be disabled in iis. "forms " you provide a custom form (web page) for users to enter their credentials, and then you authenticate them in your application. a user credential token is stored in a cookie. "passport " authentication is performed via a centralized authentication service provided by microsoft that offers a single logon and core profile services for member sites. --> <authentication mode= "windows " /> <!-- authorization this section sets the authorization policies of the application. you can allow or deny access to application resources by user or role. wildcards: "* " mean everyone, "? " means anonymous (unauthenticated) users. --> <authorization> <allow users= "* " /> <!-- allow all users --> <!-- <allow users= "[comma separated list of users] " roles= "[comma separated list of roles] "/> <deny users= "[comma separated list of users] " roles= "[comma separated list of roles] "/> --> </authorization> <!-- application-level trace logging application-level tracing enables trace log output for every page within an application. set trace enabled= "true " to enable application trace logging. if pageoutput= "true ", the trace information will be displayed at the bottom of each page. otherwise, you can view the application trace log by browsing the "trace.axd " page from your web application root. --> <trace enabled= "false " requestlimit= "10 " pageoutput= "false " tracemode= "sortbytime " localonly= "true " /> <!-- session state settings by default asp.net uses cookies to identify which requests belong to a particular session. if cookies are not available, a session can be tracked by adding a session identifier to the url. to disable cookies, set sessionstate cookieless= "true ". --> <sessionstate mode= "inproc " stateconnectionstring= "tcpip=127.0.0.1:42424 " sqlconnectionstring= "data source=127.0.0.1;trusted_connection=yes " cookieless= "false " timeout= "20 " /> <!-- globalization this section sets the globalization settings of the application. --> <globalization requestencoding= "utf-8 " responseencoding= "utf-8 " /> </system.web> <log4net> <root> <level value= "all " /> <appender-ref ref= "adonetappender " /> </root> <!-- <logger name= "testapp.logging "> <level value= "all "/> <appender-ref ref= "adonetappender " /> </logger> --> <appender name= "adonetappender " type= "log4net.appender.adonetappender "> <buffersize value= "10 " /> <connectiontype value= "system.data.sqlclient.sqlconnection, system.data, version=1.0.3300.0, culture=neutral, publickeytoken=b77a5c561934e089 " /> <connectionstring value= "server=localhost;database=demo;user id=sa;password=123456 " /> <commandtext value= "insert into log ([date],[thread],[level],[logger],[message],[exception]) values (@log_date, @thread, @log_level, @logger, @message, @exception) " /> <parameter> <parametername value= "@log_date " /> <dbtype value= "datetime " /> <layout type= "log4net.layout.rawtimestamplayout " /> </parameter> <parameter> <parametername value= "@thread " /> <dbtype value= "string " /> <size value= "255 " /> <layout type= "log4net.layout.patternlayout "> <conversionpattern value= "%thread " /> </layout> </parameter> <parameter> <parametername value= "@log_level " /> <dbtype value= "string " /> <size value= "50 " /> <layout type= "log4net.layout.patternlayout "> <conversionpattern value= "%level " /> </layout> </parameter> <parameter> <parametername value= "@logger " /> <dbtype value= "string " /> <size value= "255 " /> <layout type= "log4net.layout.patternlayout "> <conversionpattern value= "%logger " /> </layout> </parameter> <parameter> <parametername value= "@message " /> <dbtype value= "string " /> <size value= "4000 " /> <layout type= "log4net.layout.patternlayout "> <conversionpattern value= "%message " /> </layout> </parameter> <parameter> <parametername value= "@exception " /> <dbtype value= "string " /> <size value= "2000 " /> <layout type= "log4net.layout.exceptionlayout " /> </parameter> </appender> </log4net> </configuration> 2,application start protected void application_start(object sender, eventargs e) { log4net.config.domconfigurator.configure(); } 错误信息如下: --------------------------- microsoft development environment --------------------------- a project with an output type of class library cannot be started directly. in order to debug this project, go to the debugging tab under configuration settings in project properties, and set the start action to start external program or start url. alternatively, you can add a non-library project to this solution that uses a reference to this project and set it as the startup project. 帮忙看看,谢谢。在线等 |
|
|
|
|