Learning... please advise
1. Download: log4net:
Sourceforge source code to download: http://sourceforge.net/project/showfiles.php? Group_id = 31983 & package_id = 24080 & release_id = 171808
2. See sdk and manua In the doc directory of the source code package.
3. Example of log4net: http://logging.apache.org/log4net/release/config-examples.html
MATERIALS: http://blogs.acceleration.net/ryan/articles/379.aspx
The following is the configuration file of cuyahoga: <? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<ConfigSections>
<Section name = "CuyahogaSettings" type = "Cuyahoga. Core. Util. CuyahogaSectionHandler, Cuyahoga. Core"/>
<Section name = "UrlMappings" type = "Cuyahoga. Web. HttpModules. UrlMappingsSectionHandler, Cuyahoga. Web"/>
<Section name = "nhibernate" type = "System. Configuration. NameValueSectionHandler, System, Version = 1.0.5000.0, Culture = neutral, PublicKeyToken = b77a5c561934e089"/>
<Section name = "log4net" type = "log4net. Config. Log4NetConfigurationSectionHandler, log4net"/>
</ConfigSections>
<Log4net debug = "false">
<! -- Total: appender, which defines the output media Appenders may only be defined as child elements of the <log4net> element.
Each appender must be uniquely named. The implementing type for the appender must be specified. -->
<! -- Description name
Required attribute. Value must be a string name for this appender. The name must be unique among all the appenders defined in this configuration file.
This name is used by the <appender-ref> element of a Logger to reference an appender.
-->
<! -- Description type: Required attribute. Value must be the type name for this appender. If the appender is not defined in the log4net assembly this type name must be fully assembly qualified. -->
<! -- RollingFileAppender: output to file -->
<Appender name = "rollingFile" type = "log4net. Appender. RollingFileAppender, log4net"> <! -- Settings seem to be faulty, and some settings conflict -->
<! -- Define the attributes of RollingFileAppender -->
<Param name = "File" value = "log/log.txt"/> <! -- Gets or sets the path to the file that logging will be written to. -->
<Param name = "AppendToFile" value = "true"/> <! -- Gets or sets a flag that indicates weather the file shocould be appended to or overwritten -->
<Param name = "StaticLogFileName" value = "true"/> <! -- True if always shocould be logged to the same file --> <! -- Invalidates the settings of the following three rows -->
<Param name = "RollingStyle" value = "Date"/> <! -- Gets or sets the rolling style, and Date is the RollingMode enumerated value Roll files based only on the date -->
<Param name = "DatePattern" value = "yyyy. MM. dd"/> <! -- Gets or sets the datepattern to be used for generating file names when rolling over on date. -->
<Param name = "CountDirection" value = "1"/> <! -- CountDirection> 0 does the opposite, increasing from 1 is infinite -->
<! -- File name format: (or file. log. curSizeRollBackup or even file. log. yyyy-mm-dd.curSizeRollBackup). -->
<! -- Layout: The formatter for output logs.
Displays formatted output information to the user. The output information can be displayed in multiple formats, mainly dependent on the Layout component type we use.
It can be a linear or XML file. The Layout component works with an Appender component. The API help manual contains a list of different Layout components.
An Appender object can correspond to only one Layout object. To implement your own Layout class, you need to inherit from the log4net. Layout. LayoutSkeleton class, which implements the ILayout interface.
Layout elements may only be defined as children of <appender> elements. -->
<Layout type = "log4net. Layout. PatternLayout, log4net"> <! -- Defines the layout used by this appender -->
<Param name = "ConversionPattern" value = "% d [% t] %-5 p % c [% x] & lt; % X {auth} & gt; -% m % n "/>
</Layout>
</Appender>
<Root>
<Priority value = "ERROR"/> <! -- Only the level element is displayed in the document? -->
<! -- Level: Optional element, maximum of one allowed. Defines the logging level for this
Logger. This logger will only accept event that are at this level or above -->
<Appender-ref = "rollingFile"/>
</Root>
<Logger name = "Cuyahoga. Core. Service. CoreRepository">
<Level value = "ERROR"/>
</Logger>
<Logger name = "Cuyahoga. Web. HttpModules. UrlHandlerModule">
<Level value = "INFO"/>
</Logger>
</Log4net>
</Configuration>
<! -- Root in the framework system, all log objects are descendants of root logger.
Therefore, if a log object is not explicitly defined in the configuration file, the framework uses the attributes defined in the root log. In the <root> label, you can define the list of level values and Appender.
If no LEVEL value is defined, the default value is DEBUG. You can use the <appender-ref> label to define the Appender object used by the log object. <Appender-ref> declares a reference to the Appender object defined elsewhere. The setting in a logger object overwrites the setting of the root log.
For the Appender attribute, the sub-log object inherits the Appender list of the parent log object. This default behavior can also be changed by explicitly setting <logger>; the additivity attribute of the tag is false. -->
<! -- Format name meaning
% C full name of the class to which the output log information belongs
% D date or time of the log output time point. The default format is ISO8601. You can also specify the format after it, for example, % d {yyy-MM-ddHH: mm: ss }, output: 2002-10-18-22:10:28
% F Class Name of the class to which the output log information belongs
% L location where the log event is output, that is, the number of lines in the class where the statement that outputs the log information is located
% M output the specified information in the Code, such as the message in log (message)
% N output a carriage return line break. For Windows, the value is \ r \ n, and for Unix, the value is \ n"
% P output priority, that is, DEBUG, INFO, WARN, ERROR, FATAL. If it is output by calling debug (), it is DEBUG, and so on.
% R the number of milliseconds it takes to output the log information from application startup to output.
% T name of the thread that outputs the log event
-->
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service