[转]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
HttpContextitem 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 可以适用于 . ...
随机推荐
- Java面向对象之继承extends 入门实例
一.基础概念 (一)继承的好处: 1.继承:提高了代码的复用性. 2.让类与类之间产生了关系,给多态这个特征提供了前提. (二)继承的种类: 1.单继承:一个类只能有一个父类. 2.多继承:一个类可以 ...
- 在Pd中取消Code Name 同步
以前记得现在忘记了,好不容易找回来,记住备忘吧.
- HTTP原理 请求方法
HTTP的工作过程 一次HTTP操作称为一个事务,其工作过程分为四步: 1.客户机与服务器建立连接:客户单击某个超级链接,HTTP的工作开始,接下来进行TCP连接的三次握手过程. 2.建立连接后,客户 ...
- PHP编程入门与应用
基础语法.流程控制语句.数组的应用.字符串的应用————3天 PHP函数————3天 面向对象————3天 文件处理————2天 获取页面数据.会话处理————3天 数据库————5天 XML和JSO ...
- Java 实现手机发送短信验证码
Java 实现手机发送短信验证码 采用引入第三方工具的方式,网上查了半天,发现简单的实现方式便是注册一个中国网建的账号,新建账号的时候会附带赠几条免费短信,彩信 ,之后想要在使用就得花钱了.简单的操作 ...
- mysql 外键问题
清空.删除具有外键约束的表时报ERROR 1701(42000)的解决 解决方法: 解除外键约束mysql> set foreign_key_checks=0; 删除表后添加外键约束 mysql ...
- C++_类继承7-类设计回顾
编译器生成的成员函数 编译器会自动生成一些公有的成员函数——特殊成员函数. 1. 默认构造函数 提供构造函数的动机之一是确保对象总能被正确地初始化.如果类包含指针成员,则必须初始化这些成员.最好提供一 ...
- python-Generalization of Hops
python provides a general purpose HOP,map simple form-a unary function and a collection of suitable ...
- CodeForces 1043D Mysterious Crime 区间合并
题目传送门 题目大意: 给出m个1-n的全排列,问这m个全排列中有几个公共子串. 思路: 首先单个的数字先计算到答案中,有n个. 然后考虑多个数字,如果有两个数字相邻,那么在m个串中必定都能找到这两个 ...
- 比较两种数组随机排序方法的效率 JavaScript版
//比较2中数组随机排序方法的效率 JavaScript版 //randon1思路 //当len=5时候,从0-5中随机3一个放入i=0, // 从0-3随机一个2放入i=2 // 从0-2随机一个1 ...