Log4net configuration,

Source: Internet
Author: User

Log4net configuration,

<Configuration> <configSections> <section name = "log4net" type = "log4net. Config. Log4NetConfigurationSectionHandler, log4net"/> </configSections> </appsetctions> <! -- Log file configuration --> <log4net> <root> <! -- Only events at or above this level are recorded --> <level value = "ALL"/> <! -- RollingFileAppender Event Log, one log every day --> <appender-ref = "LogFileAppender_DateFormat"/> </root> <! -- Logger name: required. The logger name additi.pdf: Optional. The value is true or false. The default value is true. When set to false, the appender --> <logger name = "myLoggin"> <! -- Only events at or above this level are recorded --> <level value = "DEBUG"/> <appender-ref = "LogFileAppender_DateFormat"/> </logger> <! -- Defines the log output method, which can only be a sub-element of log4net. The name attribute must be unique and the type attribute must be specified. Name: required, Appender Object name type: required, Appender object output type --> <appender name = "LogFileAppender_DateFormat" type = "log4net. Appender. RollingFileAppender"> <! -- Save path: The following path automatically creates a Log folder when the project is started --> <file value = "Log \"/> <appendToFile value = "true"/> <! -- How to generate multiple log files (Date, Size, and combination of [Composite]) --> <rollingStyle value = "Date"/> <! -- This is a folder generated by date --> <datePattern value = "yyyy \ yyyyMM \ yyyyMMdd'.txt '"/> <! -- Whether to write data to only one file --> <staticLogFileName value = "false"/> <param name = "AppendToFile" value = "true"/> <! -- Control the output format of the Appender, or xml. An Appender can only be a layout --> <layout type = "log4net. Layout. PatternLayout"> <! -- Text description at the end of each log --> <param name = "Header" value = "[Header]"/> <param name = "Footer" value = "[Footer]" /> <param name = "ConversionPattern" value = "% n exception time: % date % n thread ID: [% thread] % n log level: %-5 level % n record class: % logger % n operation type: % property {Action} % n Message description: % property {Message} % n exception: % exception % n Message: % message % newline % n "/> </layout> <! -- Define a filter --> <filter type = "log4net. filter. levelRangeFilter "> <param name =" LevelMin "value =" DEBUG "/> <param name =" LevelMax "value =" WARN "/> </filter> </appender> <appender name = "leleappender" type = "log4net. appender. consoleAppender "> <layout type =" log4net. layout. patternLayout "> <param name =" ConversionPattern "value =" % d [% t] %-5 p % c [% x]-% m % n "/> </layout> </appender> </log4net> </configuration>

Generate logs:

 

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.