It is too complicated to simulate HttpContext for testing-driven development on the Web.
The moq framework provides powerful simulation capabilities. However, you still need to manually simulate an HttpContext object.
For this reason, I wrote a method to complete the job. Log4Net is also used to output its working conditions.
View sourceprint?
01 ///
02 // create a context simulation object
03 // at least support required
04 // Request
05 // AppRelativeCurrentExecutionFilePath,
06 // Applicatio
from logmanager and call one of the log methods. see. net_logging_api for more information. let's add some logging code to mainpage. XAML. CS: Namespace Windowsphoneapplication2 { Using System. windows; Using Microsoft. Phone. controls; Public Partial Class Mainpage: phoneapplicationpage { Private Static Nlog. Logger logger = nlog. logmanager. getcurrentclasslogger (); // Constructor Publ
Information, used to describe the importance of this information. Nlog supports the following record levels:
Trace-The most common record information, generally used for normal output
Debug-The same information is recorded, but the frequency is less than that of Trace, which is generally used to debug programs.
Info-Message of information type
Warn-Warning information, which is generally used in important scenarios
Error-Error message
Fatal-Fatal exception information. Generally, the pro
be tested in sequence. when we implement all the above four techique schemes, we can configure them through the menu and use only one global scalar to mark the corresponding techiqueid. If we select ultrahigh, we choose id = 0 when using materials.
4. A vertex can be affected by a maximum of four bones.
5. Archive abstract class for file reading. If you want to read your own package, let's inherit it! And inherit a new archivefactory.
6. pluginfolder =./plugins indicates that the plug-in DLL is
information or error information. In real environments. It is enough to open the log level to ERROR, because in the real environment, we are most concerned about the ERROR information. If the log level is relatively low, too many log outputs may affect the application performance.
Log4j can be initialized in two ways. The first is the Properties file initialization, and the second is the xml file initialization. When the system used the Log4j class for the first time, for example, the getLogger
Namespace MyLog4net{Public static class Mylog4net{Public enum ErrorLogType{/// /// Fatal error log/// FatalLog,/// /// Error Log/// ErrorLog}
/// /// When a prompt is required, you must specify the log type, which is generally used when the system prompts you how to operate,/// This type should be used for even warning operations/// Public enum NormalLogType{/// /// Common operation log/// InfoLog,/// /// Warning log/// WarnLog,/// /// Debug log/// DebugLog}/// /// System Operation Log (info, wa
Log4j 2.0 advanced usage in development-console output with simple configuration (3), log4j usageLog4j 2.0 has recently ushered in major version upgrades. In addition to the deadlock bug in 1.x, the performance is also improved by 10 times.The new features are also available in the latest version. The configuration file is not limited to the xml and java properties files. Json and yaml configuration files are supported.The use of logs is often used in our daily development. Many experts have als
configuration file is the configuration. config configuration file for the website,
3)
4)
5)
6) for more information about how to configure ASP. NET applications, visit
7) http://go.microsoft.com/fwlink? Linkid = 169433
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) Note:
37) The test code is as follows (this is the background code
Text format description
The log types that can be recorded include fatal, error, warn, info, and debug ).
Text parameter description
% M (Message): the output Log message, such as ilog. debug (...) Output Message% N (New Line): line feed% D (datetime): time when the current statement is output% R (Run time): OutputProgramNumber of milliseconds consumed from running to execution to the current statement% T (thread ID): The thread ID of the current statement is equivalent to % thread% P (prio
Http://msdn.microsoft.com/zh-cn/magazine/ee291628.aspx
* Note that "Property Export" should be compared with the previous article (2) "Property import.
Public class loggerpart{[Export]Public ilog Logger{Get {return logmanager. getlogger ("logger");} // logmanager. getlogger is a "non-MEF program" and is encapsulated into a MEF program by properties.}}
Property Export is like a Swiss Army knife in its fun
IIS7.5 migration, iis7.5 Configuration
When the Asp.net application is migrated to IIS7.5, the site reports an HTTP Error 404.0-Not Found. The process is as follows:Runtime Environment: Framework 2.0, IIS7.5, and a set of Web sites without source code. The application pool is in Classic mode by default.The URL of the error page is as follows: http: // localhost/HL2008/UI/AutoMonitor/135? Autorun = trueWhen we see this URL address, the first response is that the HttpModule is overwritten. We deco
things can be done together and I will share it with you. Please point out the problem. The key is to solve the problem that the key of hashmap cannot be repeated. Nothing else. The previous modification is attached to the end.
Import java. lang. reflect. field; import java. SQL. preparedStatement; import java. SQL. resultSet; import java. SQL. resultSetMetaData; import java. SQL. SQLException; import java. util. arrayList; import java. util. iterator; import java. util. linkedHashMap; import j
Save log4net to database series 3. Configure log4net and xmllog4net in xml Code
There are many posts in the garden about how to save log4net to the database, but it is not easy to do it. I learned how to configure log4net in log4net Database Log 1 and WebConfig from the beginning.
1. Configure log4net in WebConfig
2. Configure log4net in the independent configuration file
3. Configure log4net in xml Code
Iv. complete code configuration log4net
5. Add database fields
Next, we will learn h
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.