Log4net log output format-log4net. layout. patternlayout usage

Source: Internet
Author: User
Tags log4net

Characters

Effect

A

EquivalentAppdomain

Appdomain

Used to output the friendly name of the appdomain where the logging event was generated.

A friendly name used to indicate the appdomain generated by a daily event.

C

EquivalentLogger

C

EquivalentType

Class

EquivalentType

D

EquivalentDate

Date

The date used to indicate the date of the sunrise event in the previous time zone. to export a common time, use the % utcdate mode. after a date Delimiter is specified, a pair of tokens can be matched with the delimiter. The Delimiter is specified for the date format. for example:% Date {hh: mm: SS, fff}Or% Date {dd Mmm yyyy hh: mm: SS, fff },If no format is specified, it is deemed as iso8601 (iso8601dateformatter ).

The format of the Delimiter is the same as that of the tostring.

We recommend that you use the log4net date formatter to improve the effect of loading to logs. They can use the following strings: "absolute", "date", "ISO 8601" To specify absolutetimedateformatter, datetimedateformatter, andIso8601dateformatter.For example: % Date {iso8601}Or% Date {absolute}.

The date formatter used for these operations is much better than the tostring.

Exception

Used when the same day when the same token information is merged.

If a regular photo object is stored in a daily registration event, it will be output in the trailing newline mode. No, no.

F

EquivalentFile

File

Used to export the name of the file requested by log reference.

Example: C: \ Inetpub \ wwwroot \ logtest \ webform1.aspx. CS

Warning:The location information of the production caller is relatively slow. The number of callers should not be used unless the record speed is not a problem.

Identity

Used to specify the principal name (principal. Identity. Name) used before execution ).

Warning:The location information of the production caller is relatively slow. The number of callers should not be used unless the record speed is not a problem.

L

EquivalentLocation

L

EquivalentLine

Location

The location information of the caller who generates the birthday event.

This location information is based on the actual situation of CLI, but it is usually named as a method with a limited space and is used to include the caller's name and line numbers.

Example: logtest. webform1.button3 _ click (C: \ Inetpub \ wwwroot \ logtest \ webform1.aspx. CS: 93)

Location information is very useful. However, its production is quite slow. The number of snapshots should not be used unless the speed of the rows is not a problem.

Level

It is used to record events.

Line

Used to parse the line for sending the log reporter request.

Warning:The location information of the production caller is relatively slow. The number of callers should not be used unless the record speed is not a problem.

Logger

This parameter is used to indicate the name of the day when a daily event is generated. this day's response character can follow the precision. The precision is a constant of 10 hexadecimal notation, which is enclosed by flowers. if an accuracy character is specified, only the corresponding data names from right to left are displayed, and all values are entered.

The name of A. B. C is as follows ",% Logger {2}"B. C"

M

EquivalentMessage

M

EquivalentMethod

Message

Used to compile the information provided by the application to log on to the event.

MDC

MDC (Region name: threadcontext. properties) is a part of the event consistency. This mode supports compatibility, but is equivalentProperty.

Method

The name of the method used to calculate the log reference.

Warning:The location information of the production caller is relatively slow. The number of callers should not be used unless the record speed is not a problem.

N

EquivalentNewline

Newline

Limit row, equivalent to "\ n" or "\ r \ n"

P

EquivalentLevel

P

EquivalentProperty

Properties

EquivalentProperty

Property

 

It is used to specify the adequacy of an event. the property name should be included in the parameter and placed directly behind the property. example: % property {user }. every attention in the Daily Routine must be specified by the daily routine. properties is added to the event by the log recorder or append. the default value is log4net: Hostname, which is the name of the machine that generates the event.

If no irrelevant word is specified, for example:% Property, The shard value will be used to tease the shard list

R

EquivalentTimestamp

T

EquivalentThread

Timestamp

Used to indicate the time when a program was created from a program event to a daily event, in milliseconds.

Thread

It is used to indicate the name of the program that initiates a daily event. If no program name is specified, the program name is used.

Type

Use the same Logger

Warning:The location information of the production caller is relatively slow. The number of callers should not be used unless the record speed is not a problem.

U

EquivalentIdentity

Username

Used to extract the windowsidentity that was previously used

Warning:The location information of the production caller is relatively slow. The number of callers should not be used unless the record speed is not a problem.

Utcdate

Use the same date

W

EquivalentUsername

X

EquivalentNDC

X

EquivalentMDC

%

% Outgoing one %

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.