Layout Renderers
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-application} - ASP.NET Application variable.
- ${aspnet-item} - ASP.NET
HttpContext
item variable. - ${aspnet-request} - ASP.NET Request variable.
- ${aspnet-session} - ASP.NET Session variable.
- ${aspnet-sessionid} - ASP.NET Session ID.
- ${aspnet-user-authtype} - ASP.NET User variable.
- ${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.
Layout Renderers的更多相关文章
- [转]NLog Layout Renderers ${}
https://github.com/nlog/NLog/wiki/Layout-Renderers Layout renderers are template macros that are use ...
- XF custom render 各平台实现类
目前的XF还是非常简陋的,所以存在大量的自定义工作.一般情况下我们只是要需要派生原生的XF控件,然后在各平台下修改其呈现方法. 所以了解每个XF控件在不同平台上呈现使用的控件类是有所必须要的.以下别人 ...
- C#开源日志Nlog入门
c#语言使用的日志比较多,比如:Log4.NLog等,今天我就简单随笔记录哈NLog的使用. 1.NLog的安装: 直接在VS编译器中打开程序包管理器,输入Install-Package NLogin ...
- .NET中使用NLog记录日志
以前小编记录日志使用的是Log4Net,虽然好用但和NLog比起来稍显复杂.下面小编就和大伙分享一下NLog的使用方式. 引用NLog.Config 在使用NLog之前,我们要首先添加对NLog.Co ...
- log4net 发布到生产环境不写日志的解决方法--使用 NLog日志
1.升级到log4net的最新版 PM下执行 Install-Package log4net 还是无法解决的,使用下面的方法 2.使用Nlog替换之,详见https://github.com/NLog ...
- NLog文章系列——如何配置NLog(转)
NLog使用方法 作者:Jaros?aw Kowalski <> 翻译:CrazyCoder(由衷感谢他的热心!!) 原文:http://www.nlog-project.org/conf ...
- NLog文章系列——如何配置NLog
NLog支持以多种不同方式配置,目前同时支持直接编程和使用配置文件两种方法.本文将对目前支持的各种配置方式作详细描述. 日志配置 通过在启动的时候对一些常用目录的扫描,NLog会尝试使用找到的配置信息 ...
- NLog官方文档
NLog快速使用 NLog配置 NLog通过代码定义配置 Target Layouts Layout Renderers
- NLog 安装使用
1:安装 Install-Package NLog.Config 或 通过Nuget 2:Log levels Trace 非常详细的信息,一般在开发时使用. Debug 比Trace稍微少一点一般不 ...
随机推荐
- c# 获取某个对象的[公有属性]的名称,类型,值
/// <summary> /// 获取某个对象的[公有属性]的名称,类型,值 /// </summary> /// <typeparam name="T&qu ...
- ServletWeb缓存解决问题
(1)为什么我们要防止这个问题的浏览器页面缓存: 所以在不须要缓存的页面中须要实现不缓存页面. 代码例如以下: package com.lc.HttpTest; import java.io.IOEx ...
- HDU2516-取石子游戏
取石子游戏 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- LatinIME输入法分析
输入法的设置在res/xml/method.xml的<input-method>标签中,主要设置两个属性: android:settingsActivity,输入法的设置程序入口. and ...
- Eclipse4.4设备egit插件提交本地项目代码到远程仓库
一.设备egit 打开Eclipse的Marketplace.在搜索框中输入egit就可以,能够看到Eclipse4.4已经默认安装了egit,当然假设有新版本号的egit公布的话,也能够在下图上点击 ...
- 右键菜单中的好友列表Ajax直接跳转请求到登陆页面
今天,我们正在做正确的菜单.当点击重命名Ajax要求,并且不发送数据的背景,但直接跳到主页. 我百思不得其解,后来我发现在头版的一个问题: <li><a href='#' oncli ...
- 第三篇——第二部分——第一文 SQL Server镜像简介
原文:第三篇--第二部分--第一文 SQL Server镜像简介 原文出处:http://blog.csdn.net/dba_huangzj/article/details/26951563 镜像是什 ...
- 第七章——DMVs和DMFs(3)——用DMV和DMF监控TempDB
原文:第七章--DMVs和DMFs(3)--用DMV和DMF监控TempDB 前言: 我们都知道TempDB是SQLServer的系统数据库,且SQLServer的日常运作严重依赖这个库.因此,监控T ...
- Java 输出指定编码的字符串
Java Sting类有个根据byte,字符编码来输出的构造函数.以下为java文档中的解释.public String(byte[] bytes, String charsetName) throw ...
- SQL Server 连接问题-命名管道
原文:SQL Server 连接问题-命名管道 出自:http://blogs.msdn.com/b/apgcdsd/archive/2011/01/12/sql-server-1.aspx 一.前言 ...