[转]NLog Layout Renderers ${}
https://github.com/nlog/NLog/wiki/Layout-Renderers
Layout renderers are template macros that are used in Layouts.
NLog supports creating custom layout renderers. For more information, see: Extending NLog
Layout Renderers
NLog package 
- ${activityid} - Puts into log a System.Diagnostics trace correlation id.
- ${all-event-properties} - Log all event context data.
- ${appdomain} - Current app domain.
- ${assembly-version} - The version of the executable in the default application domain.
- ${basedir} - The current application domain's base directory.
- ${callsite} - The call site (class name, method name and source information).
- ${callsite-linenumber} - The call site source line number.
- ${counter} - A counter value (increases on each layout rendering).
- ${date} - Current date and time.
- ${document-uri} - URI of the HTML page which hosts the current Silverlight application.
- ${environment} - The environment variable.
- ${event-properties} - Log event properties data - rename of ${event-context}.
- ${exception} - Exception information provided through a call to one of the Logger.*Exception() methods.
- ${file-contents} - Renders contents of the specified file.
- ${gc} - The information about the garbage collector.
- ${gdc} - Global Diagnostic Context item. Dictionary structure to hold per-application-instance values.
- ${guid} - Globally-unique identifier (GUID).
- ${identity} - Thread identity information (name and authentication information).
- ${install-context} - Installation parameter (passed to InstallNLogConfig).
- ${level} - The log level.
- ${literal} - A string literal.
- ${log4jxmlevent} - XML event description compatible with log4j, Chainsaw and NLogViewer.
- ${logger} - The logger name.
- ${longdate} - The date and time in a long, sortable format
yyyy-MM-dd HH:mm:ss.ffff
. - ${machinename} - The machine name that the process is running on.
- ${mdc} - Mapped Diagnostics Context - a thread-local structure.
- ${mdlc} - Async Mapped Diagnostics Context - a thread-local structure.
- ${message} - The formatted log message.
- ${ndc} - Nested Diagnostics Context - a thread-local structure.
- ${newline} - A newline literal.
- ${nlogdir} - The directory where NLog.dll is located.
- ${performancecounter} - The performance counter.
- ${processid} - The identifier of the current process.
- ${processinfo} - The information about the running process.
- ${processname} - The name of the current process.
- ${processtime} - The process time in format HH:mm:ss.mmm.
- ${qpc} - High precision timer, based on the value returned from QueryPerformanceCounter() optionally converted to seconds.
- ${registry} - A value from the Registry.
- ${shortdate} - The short date in a sortable format yyyy-MM-dd.
- ${sl-appinfo} - Information about Silverlight application.
- ${specialfolder} - System special folder path (includes My Documents, My Music, Program Files, Desktop, and more).
- ${stacktrace} - Stack trace renderer.
- ${tempdir} - A temporary directory.
- ${threadid} - The identifier of the current thread.
- ${threadname} - The name of the current thread.
- ${ticks} - The Ticks value of current date and time.
- ${time} - The time in a 24-hour, sortable format HH:mm:ss.mmm.
- ${var} - Render variable (new in 4.1)
- ${windows-identity} - Thread Windows identity information (username).
Wrappers
- ${cached} - Applies caching to another layout output.
- ${filesystem-normalize} - Filters characters not allowed in the file names by replacing them with safe character.
- ${json-encode} - Escapes output of another layout using JSON rules.
- ${lowercase} - Converts the result of another layout output to lower case.
- ${onexception} - Only outputs the inner layout when exception has been defined for log message.
- ${pad} - Applies padding to another layout output.
- ${replace} - Replaces a string in the output of another layout with another string.
- ${replace-newlines} - Replaces newline characters with another string.
- ${rot13} - Decodes text "encrypted" with ROT-13.
- ${trim-whitespace} - Trims the whitespace from the result of another layout renderer.
- ${uppercase} - Converts the result of another layout output to upper case.
- ${url-encode} - Encodes the result of another layout output for use with URLs.
- ${when} - Only outputs the inner layout when the specified condition has been met.
- ${whenEmpty} - Outputs alternative layout when the inner layout produces empty result.
- ${WrapLine} - Wraps the result of another layout output at specified line length.
- ${xml-encode} - Converts the result of another layout output to be XML-compliant.
NLog.Extended package 
- ${appsetting} - App config setting.
NLog.Web package 
- ${aspnet-MVC-Action} - ASP.NET MVC action name
- ${aspnet-MVC-Controller} - ASP.NET MVC controller name
- ${aspnet-Application} - ASP.NET Application variable.
- ${aspnet-Item} - ASP.NET
HttpContext
item variable. - ${aspnet-TraceIdentifier} - ASP.NET trace identifier
- ${aspnet-Request} - ASP.NET Request variable.
- ${aspnet-Request-Cookie} - ASP.NET Request cookie content.
- ${aspnet-Request-Host} - ASP.NET Request host.
- ${aspnet-Request-Method} - ASP.NET Request method (GET, POST etc).
- ${aspnet-Request-QueryString} - ASP.NET Request querystring.
- ${aspnet-Request-Referrer} - ASP.NET Request referrer.
- ${aspnet-Request-UserAgent} - ASP.NET Request useragent.
- ${aspnet-Request-Url} - ASP.NET Request URL.
- ${aspnet-Session} - ASP.NET Session variable.
- ${aspnet-SessionId} - ASP.NET Session ID variable.
- ${aspnet-User-AuthType} - ASP.NET User auth.
- ${aspnet-User-Identity} - ASP.NET User variable.
- ${iis-site-name} - IIS site name.
External packages
External packages, not maintained by the NLog team.
Passing Custom Values to a Layout
Even though the layout renderers provide many pre-defined values, you may need to pass application specific values to your Layouts. You can pass your own values in code by adding custom properties to the event. You then retrieve the value using the ${event-properties} renderer. See the documentation for the ${event-properties} for an example.
[转]NLog Layout Renderers ${}的更多相关文章
- Nlog Layout
Nlog.config <targets> <target type="Console" name="trace" layout=&q ...
- Layout Renderers
Layout Renderers NLog package ${activityid} - Puts into log a System.Diagnostics trace correlation i ...
- NLog官方文档
NLog快速使用 NLog配置 NLog通过代码定义配置 Target Layouts Layout Renderers
- [转]Using NLog for ASP.NET Core to write custom information to the database
本文转自:https://github.com/NLog/NLog/issues/1366 In the previous versions of NLog it was easily possibl ...
- 关于NLog的target和Layout
这个没啥好说的,都是用别人的东西,看文档就行了,写的很详细. https://github.com/NLog/NLog/wiki/Configuration-file https://github.c ...
- Nlog配置实例
彩色Console target <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns= ...
- NLog在Asp.Net MVC的实战应用
Asp.Net MVC FilterAttribute特性.读取xml反序列化.NLog实战系列文章 首先新建一个MVC project. 一.NLog的配置. 作者:Jarosław Kowalsk ...
- [转]C# 使用Nlog记录日志到数据库
本文转自:http://www.cnblogs.com/weixing/archive/2013/04/26/3044422.html 摘要]Nlog是一个很不错的.NET日志记录组件,它可以将日志输 ...
- [转]ASP.NET Core 开发-Logging 使用NLog 写日志文件
本文转自:http://www.cnblogs.com/Leo_wl/p/5561812.html ASP.NET Core 开发-Logging 使用NLog 写日志文件. NLog 可以适用于 . ...
随机推荐
- CH收藏的书
论语 道德经 墨子
- 洛谷P3711 仓鼠的数学题(伯努利数+多项式求逆)
题面 传送门 题解 如果您不知道伯努利数是什么可以去看看这篇文章 首先我们把自然数幂和化成伯努利数的形式 \[\sum_{i=1}^{n-1}i^k={1\over k+1}\sum_{i=0}^k{ ...
- centos6 x64安装elasticsearch5.5.2启动报错
ERROR: [3] bootstrap checks failed[1]: max file descriptors [4096] for elasticsearch process is too ...
- python中文件路径的问题
慎用中文路径!慎重中文路径!!慎用中文路径!!! good = np.loadtxt(u'D:/feiq/feiq/Recv Files/Recv Files/LOS 数据集/good_user2', ...
- Node.js的mysql执行多表联合查询
数据库(test)中的表结构(admin.user) //执行多表结合查询 var mysql = require('mysql'); var connection = mysql.createCon ...
- fork 炸弹
一段古老的Linux shell程序 :() { :|:& };: 这是bash shell的写法,首先定义了一个函数:(),花括号里面是函数体,这里递归执行函数本身,通过管道在后台再递归运行 ...
- php中magic_quotes_gpc的作用 解决日文数据提交后多出来反斜杠的问题
magic_quotes_gpc发生作用是在传递$_GET,$_POST,$_COOKIE时 1.条件: magic_quotes_gpc=off写入数据库的字符串未经过任何过滤处理.从数据库读出的字 ...
- Android 单选按钮(RadioButton)和复选框(CheckBox)的使用
1.RadioButton (1)介绍 (2)单选按钮点击事件的用法 (3)RadioButton与RadioGroup配合使用实现单选题功能 (4)xml布局及使用 <?xml version ...
- C++_异常4-将对象用作异常类型
通常,引发异常的函数将传递一个对象.这样做的重要优点之一就是,可以利用不同的异常类型来区分不同的函数在不同的情况下引发的异常. 对象可以携带信息,程序员可以根据这些信息来确定异常的原因. 同时,cat ...
- 线性递推规律BM杜教
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> # ...