[转]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 可以适用于 . ...
随机推荐
- L - Ch’s gift HDU - 6162
Ch’s gift Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total S ...
- OOP1(定义基类和派生类)
面向对象程序设计基于三个基本概念:数据抽象,继承和动态绑定 数据抽象是一种依赖于接口和实现分离的编程技术.继承和动态绑定对程序的编号有两方面的影响:一是我们可以更容易地定义与其它类相似但不完全相同的类 ...
- Pycharm使用的一些问题!!!
1.pycharm如何更改主题.如何更改字体的大小? 2.pycharm如何import第三方库? 1.更改主题和字体大小 主题变暗,字体变大! 2.如何导入第三方库?
- Eclipse设置自动生成的javadoc
1.点击 Window -> Preference -> Java -> Code Style -> Code Template ,在右边选择 Comments -> 相 ...
- 一款很好用的页面滚动元素动画插件-AOS.JS
aos.js是一款效果超赞的页面滚动元素动画jQuery动画库插件.该动画库可以在页面滚动时提供28种不同的元素动画效果,以及多种easing效果.在页面往回滚动时,元素会恢复到原来的状态. 加载方法 ...
- JAVA GET 和 POST 的区别
GET 和 POST 的区别 GET请注意,查询字符串(名称/值对)是在 GET 请求的 URL 中发送的:/test/demo_form.asp?name1=value1&name2=val ...
- 老实pear_Excel 操作类 Spreadsheet_Excel_Writer 常用参数说明
(如果是PHP5项目就不用往下看了,因为PHP5项目可以直接用PHPExcel,方便快捷) 手上有个PHP4的修改项目,要修改Excel的导出,然后再把导出的Excel再导入到系统里. 在导入的时候, ...
- python get() 和getattr()
get() Python 字典 get() 函数返回指定键的值,如果值不在字典中返回默认值. 语法: dict.get(key, default=None) 实例1: d={'A':1,'b':2} ...
- Android 对话框的应用1
1.介绍 2.作用 (1)消息提示对话框 (2)简单列表对话框 (3)单选列表对话框 (4)多选对话框 (5)自定义对话框 3.java后台代码 package com.lucky.test28dia ...
- C++_标准模板库STL概念介绍3-函数对象
函数对象也叫做函数符(functor). 函数符是可以以函数方式和( )结合使用的任意对象. 包括函数名,指向函数的指针,重载了()运算符的类对象. 可以这样定义一个类: class Linear { ...