conversation pattern_inverted pattern

conversation pattern_inverted patternSample<paramname=”ConversionPattern”value=”%d[%t]%-5p%c[%x]%X{auth}-Line:%L%m%n”/> %m(message):输出的日志消息%n(newline):換行%d(datetime):输出当前语句运行的时刻%r(runtime):输出程序从运行到执…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

Sample

<param name=”ConversionPattern” value=”%d [%t] %-5p %c [%x] %X{auth} – Line:%L %m%n” />

 

%m(message):输出的日志消息

%n(new line):換行

%d(datetime):输出当前语句运行的时刻

%r(run time):输出程序从运行到执行到当前语句时消耗的毫秒数

%t(thread id):当前语句所在的线程ID

%p(priority): 日志的当前优先级别,即DEBUG、INFO、WARN…等

%c(class):当前日志对象的名称

%L:输出语句所在的行号

%F:输出语句所在的文件名

%-数字:表示该项的最小长度,如果不够,则用空格填充

%X:mdc

%x:ndc

官方文档

http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html

Conversion Pattern Name

Effect

a

Equivalent to appdomain

appdomain

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

aspnet-cache

Used to output all cache items in the case of %aspnet-cache or just one named item if used as %aspnet-cache{key}

This pattern is not available for Compact Framework or Client Profile assemblies.

aspnet-context

Used to output all context items in the case of %aspnet-context or just one named item if used as %aspnet-context{key}

This pattern is not available for Compact Framework or Client Profile assemblies.

aspnet-request

Used to output all request parameters in the case of %aspnet-request or just one named param if used as %aspnet-request{key}

This pattern is not available for Compact Framework or Client Profile assemblies.

aspnet-session

Used to output all session items in the case of %aspnet-session or just one named item if used as %aspnet-session{key}

This pattern is not available for Compact Framework or Client Profile assemblies.

c

Equivalent to logger

C

Equivalent to type

class

Equivalent to type

d

Equivalent to date

date

Used to output the date of the logging event in the local time zone. To output the date in universal time use the %utcdate pattern. The date conversion specifier may be followed by a date format specifier enclosed between braces. For example, %date{HH:mm:ss,fff}or %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is given then ISO8601 format is assumed (Iso8601DateFormatter).

The date format specifier admits the same syntax as the time pattern string of theToString.

For better results it is recommended to use the log4net date formatters. These can be specified using one of the strings “ABSOLUTE”, “DATE” and “ISO8601” for specifyingAbsoluteTimeDateFormatterDateTimeDateFormatter and respectivelyIso8601DateFormatter. For example, %date{ISO8601} or %date{ABSOLUTE}.

These dedicated date formatters perform significantly better than ToString.

exception

Used to output the exception passed in with the log message.

If an exception object is stored in the logging event it will be rendered into the pattern output with a trailing newline. If there is no exception then nothing will be output and no trailing newline will be appended. It is typical to put a newline before the exception and to have the exception as the last data in the pattern.

F

Equivalent to file

file

Used to output the file name where the logging request was issued.

WARNING Generating caller location information is extremely slow. Its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

identity

Used to output the user name for the currently active user (Principal.Identity.Name).

WARNING Generating caller information is extremely slow. Its use should be avoided unless execution speed is not an issue.

l

Equivalent to location

L

Equivalent to line

location

Used to output location information of the caller which generated the logging event.

The location information depends on the CLI implementation but usually consists of the fully qualified name of the calling method followed by the callers source the file name and line number between parentheses.

The location information can be very useful. However, its generation is extremely slow. Its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

level

Used to output the level of the logging event.

line

Used to output the line number from where the logging request was issued.

WARNING Generating caller location information is extremely slow. Its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

logger

Used to output the logger of the logging event. The logger conversion specifier can be optionally followed by precision specifier, that is a decimal constant in brackets.

If a precision specifier is given, then only the corresponding number of right most components of the logger name will be printed. By default the logger name is printed in full.

For example, for the logger name “a.b.c” the pattern %logger{2} will output “b.c”.

m

Equivalent to message

M

Equivalent to method

message

Used to output the application supplied message associated with the logging event.

mdc

The MDC (old name for the ThreadContext.Properties) is now part of the combined event properties. This pattern is supported for compatibility but is equivalent to property.

method

Used to output the method name where the logging request was issued.

WARNING Generating caller location information is extremely slow. Its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

n

Equivalent to newline

newline

Outputs the platform dependent line separator character or characters.

This conversion pattern offers the same performance as using non-portable line separator strings such as “\n”, or “\r\n”. Thus, it is the preferred way of specifying a line separator.

ndc

Used to output the NDC (nested diagnostic context) associated with the thread that generated the logging event.

p

Equivalent to level

P

Equivalent to property

properties

Equivalent to property

property

Used to output the an event specific property. The key to lookup must be specified within braces and directly following the pattern specifier, e.g. %property{user} would include the value from the property that is keyed by the string ‘user’. Each property value that is to be included in the log must be specified separately. Properties are added to events by loggers or appenders. By default the log4net:HostName property is set to the name of machine on which the event was originally logged.

If no key is specified, e.g. %property then all the keys and their values are printed in a comma separated list.

The properties of an event are combined from a number of different contexts. These are listed below in the order in which they are searched.

the event properties

The event has Properties that can be set. These properties are specific to this event only.

the thread properties

The Properties that are set on the current thread. These properties are shared by all events logged on this thread.

the global properties

The Properties that are set globally. These properties are shared by all the threads in the AppDomain.

r

Equivalent to timestamp

stacktrace

Used to output the stack trace of the logging event The stack trace level specifier may be enclosed between braces. For example, %stacktrace{level}. If no stack trace level specifier is given then 1 is assumed

Output uses the format: type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1

This pattern is not available for Compact Framework assemblies.

stacktracedetail

Used to output the stack trace of the logging event The stack trace level specifier may be enclosed between braces. For example, %stacktracedetail{level}. If no stack trace level specifier is given then 1 is assumed

Output uses the format: type3.MethodCall3(type param,…) > type2.MethodCall2(type param,…) > type1.MethodCall1(type param,…)

This pattern is not available for Compact Framework assemblies.

t

Equivalent to thread

timestamp

Used to output the number of milliseconds elapsed since the start of the application until the creation of the logging event.

thread

Used to output the name of the thread that generated the logging event. Uses the thread number if no name is available.

type

Used to output the fully qualified type name of the caller issuing the logging request. This conversion specifier can be optionally followed by precision specifier, that is a decimal constant in brackets.

If a precision specifier is given, then only the corresponding number of right most components of the class name will be printed. By default the class name is output in fully qualified form.

For example, for the class name “log4net.Layout.PatternLayout”, the pattern %type{1}will output “PatternLayout”.

WARNING Generating the caller class information is slow. Thus, its use should be avoided unless execution speed is not an issue.

See the note below on the availability of caller location information.

u

Equivalent to identity

username

Used to output the WindowsIdentity for the currently active user.

WARNING Generating caller WindowsIdentity information is extremely slow. Its use should be avoided unless execution speed is not an issue.

utcdate

Used to output the date of the logging event in universal time. The date conversion specifier may be followed by a date format specifier enclosed between braces. For example, %utcdate{HH:mm:ss,fff} or %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is given then ISO8601 format is assumed (Iso8601DateFormatter).

The date format specifier admits the same syntax as the time pattern string of theToString.

For better results it is recommended to use the log4net date formatters. These can be specified using one of the strings “ABSOLUTE”, “DATE” and “ISO8601” for specifyingAbsoluteTimeDateFormatterDateTimeDateFormatter and respectivelyIso8601DateFormatter. For example, %utcdate{ISO8601} or%utcdate{ABSOLUTE}.

These dedicated date formatters perform significantly better than ToString.

w

Equivalent to username

x

Equivalent to ndc

X

Equivalent to mdc

%

The sequence %% outputs a single percent sign.

转载于:https://www.cnblogs.com/pengzhen/p/4530180.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/172081.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • c++动态库和静态库的区别_静态库里面包含动态库

    c++动态库和静态库的区别_静态库里面包含动态库                                          C++静态库与动态库这次分享的宗旨是——让大家学会创建与使用静态库、动态库,知道静态库与动态库的区别,知道使用的时候如何选择。这里不深入介绍静态库、动态库的底层格式,内存布局等,有兴趣的同学,推荐一本书《程序员的自我修养——链接…

  • 学习Java有什么用 可以从事哪些工作

    学习Java有什么用 可以从事哪些工作Java开发应用广泛,是目前互联网行业不可缺少的语言,因此越来越多的人选择学习Java。对于初学者而言,学完Java除了可以从事Java开发之外,还可以做哪些具体的工作岗位呢?一、Android应用 Android是一种基于Linux的自由及开放源代码的操作系统,其源代码是Java。目前企业级特别大的应用,都需要学Java。而Java做安卓开发不单单是指系统,还有APP,在Andro…

  • 史上最新最全面的java大数据学习路线(新手小白必看版本)

    史上最新最全面的java大数据学习路线(新手小白必看版本)第一阶段:大数据基础Java语言基础阶段1.1:Java开发介绍1.1.1Java的发展历史1.1.2Java的应用领域1.1.3Java语言的特性1.1.4Java面向对象1.1.5Java性能分类1.1.6搭建Java环境1.1.7Java工作原理 1.2:熟悉Eclipse开发工具1.2.1Eclipse简介与下载1.2.2安…

  • 数字电路实验 05 – | 触发器及其应用[通俗易懂]

    数字电路实验 05 – | 触发器及其应用[通俗易懂]一、实验目的和任务掌握基本RS、JK、T和D触发器的逻辑功能。 掌握集成触发器的功能和使用方法。 熟悉触发器之间相互转换的方法。二、实验原理介绍触发器是能够存储1位二进制码的逻辑电路,它有两个互补输出端,其输出状态不仅与输入有关,而且还与原先的输出状态有关。触发器有两个稳定状态,用以表示逻辑状态“1”和“0”,在一定的外界信号作用下,可以从一个稳定状态翻转到另一个稳定状态,它是一个具有记忆功能的二进制信息存储器件,是构成各种时序电路的最基本逻辑单元。三、实验数据、计

  • mac录屏怎么减小文件大小_血小板体积低怎么回事

    mac录屏怎么减小文件大小_血小板体积低怎么回事有Mac录屏的需求,Mac自带的录屏软件挺好用的。就是默认帧率高达60fps,文件体积比较大。文件是.mov格式不通用。我平时录屏的内容就是演示一些软件的基本操作发送给客户,通常是临时录制(非正式),能看就行了,不需要过高的帧率。录屏文件过大反而影响qq发送。解决方案:全屏录制用EV录屏选区录制用Mac自带的QuickTimePlayer录制,录制完进行格式转换EV录屏https://www.ieway.cn/evcapture.html这个软件挺好用的,我在Windows下就

  • DDPG 算法

    DDPG 算法DDPG算法1离散动作vs.连续动作离散动作与连续动作是相对的概念,一个是可数的,一个是不可数的。在CartPole环境中,可以有向左推小车、向右推小车两个动作。在FrozenLake环境中,小乌龟可以有上下左右四个动作。在Atari的Pong游戏中,游戏有6个按键的动作可以输出。但在实际情况中,经常会遇到连续动作空间的情况,也就是输出的动作是不可数的。比如说推小车力的大小、选择下一时刻方向盘的转动角度或者四轴飞行器的四个螺旋桨给的电压的大小等等。对于这些连续

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号