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 

NLog.Web package

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的更多相关文章

  1. [转]NLog Layout Renderers ${}

    https://github.com/nlog/NLog/wiki/Layout-Renderers Layout renderers are template macros that are use ...

  2. XF custom render 各平台实现类

    目前的XF还是非常简陋的,所以存在大量的自定义工作.一般情况下我们只是要需要派生原生的XF控件,然后在各平台下修改其呈现方法. 所以了解每个XF控件在不同平台上呈现使用的控件类是有所必须要的.以下别人 ...

  3. C#开源日志Nlog入门

    c#语言使用的日志比较多,比如:Log4.NLog等,今天我就简单随笔记录哈NLog的使用. 1.NLog的安装: 直接在VS编译器中打开程序包管理器,输入Install-Package NLogin ...

  4. .NET中使用NLog记录日志

    以前小编记录日志使用的是Log4Net,虽然好用但和NLog比起来稍显复杂.下面小编就和大伙分享一下NLog的使用方式. 引用NLog.Config 在使用NLog之前,我们要首先添加对NLog.Co ...

  5. log4net 发布到生产环境不写日志的解决方法--使用 NLog日志

    1.升级到log4net的最新版 PM下执行 Install-Package log4net 还是无法解决的,使用下面的方法 2.使用Nlog替换之,详见https://github.com/NLog ...

  6. NLog文章系列——如何配置NLog(转)

    NLog使用方法 作者:Jaros?aw Kowalski <> 翻译:CrazyCoder(由衷感谢他的热心!!) 原文:http://www.nlog-project.org/conf ...

  7. NLog文章系列——如何配置NLog

    NLog支持以多种不同方式配置,目前同时支持直接编程和使用配置文件两种方法.本文将对目前支持的各种配置方式作详细描述. 日志配置 通过在启动的时候对一些常用目录的扫描,NLog会尝试使用找到的配置信息 ...

  8. NLog官方文档

    NLog快速使用 NLog配置 NLog通过代码定义配置 Target Layouts Layout Renderers

  9. NLog 安装使用

    1:安装 Install-Package NLog.Config 或 通过Nuget 2:Log levels Trace 非常详细的信息,一般在开发时使用. Debug 比Trace稍微少一点一般不 ...

随机推荐

  1. Android程序猿学习路径

    而一些工作,而不仅仅是通信毕业生,很多学生没有工作或熟练Android工作人员指导的情况下,,如何学习Android而提高Android更多关注的水平. 享: 1.Android知识 1.1.站点资源 ...

  2. Android - match_parent 和 fill_parent差异

    Android - match_parent 和 fill_parent差异 本文地址: http://blog.csdn.net/caroline_wendy match_parent 和 fill ...

  3. UVA - 12001 UVa Panel Discussion

    Description  UVa Panel Discussion  The UVa online judge team is arranging a panel discussion for the ...

  4. 最少拦截系统(杭电1257)(DP)+(贪心)

    最少拦截系统 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  5. web即时通讯2--基于Spring websocket达到web聊天室

    如本文所用,Spring4和websocket要构建web聊天室,根据框架SpringMVC+Spring+Hibernate的Maven项目,后台使用spring websocket进行消息转发和聊 ...

  6. [原创].NET 业务框架开发实战之七 业务层初步构想

    原文:[原创].NET 业务框架开发实战之七 业务层初步构想 .NET 业务框架开发实战之七 业务层初步构想 前言:本篇主要讲述如何把DAL和BLL衔接起来. 本篇议题如下: 1.       DAL ...

  7. java提高篇(十三)-----字符串

          可以证明,字符串操作是计算机程序设计中最常见的行为. 一.String 首先我们要明确,String并不是基本数据类型,而是一个对象,并且是不可变的对象.查看源码就会发现String类为f ...

  8. android 联系数据库

    联系人数据库学习 2011-10-31(这是android2.3在接触db) 简单介绍 Android中联系人的信息都是存储在一个叫contacts2.db的数据库中.该数据库的路径是:/data/d ...

  9. StackExchange.Redis 使用-配置 (四)

    Configurationredis有很多不同的方法来配置连接字符串 , StackExchange.Redis 提供了一个丰富的配置模型,当调用Connect 或者 ConnectAsync 时需要 ...

  10. swift 它们的定义TabBarItem

    1.效果图     2.NewsViewController.swift // // NewsViewController.swift // NavigationDemo // // Created ...