博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[转]NLog Layout Renderers ${}
阅读量:6297 次
发布时间:2019-06-22

本文共 4552 字,大约阅读时间需要 15 分钟。

Layout renderers are template macros that are used in .

NLog supports creating custom layout renderers. For more information, see:

Layout Renderers

NLog package

  • - Puts into log a System.Diagnostics trace correlation id.
  • - Log all event context data.
  • - Current app domain.
  • - The version of the executable in the default application domain.
  • - The current application domain's base directory.
  • - The call site (class name, method name and source information).
  • - The call site source line number.
  • - A counter value (increases on each layout rendering).
  • - Current date and time.
  • - URI of the HTML page which hosts the current Silverlight application.
  • - The environment variable.
  • - Log event properties data - rename of ${event-context}.
  • - Exception information provided through a call to one of the Logger.*Exception() methods.
  • - Renders contents of the specified file.
  • - The information about the garbage collector.
  • - Global Diagnostic Context item. Dictionary structure to hold per-application-instance values.
  • - Globally-unique identifier (GUID).
  • - Thread identity information (name and authentication information).
  • - Installation parameter (passed to InstallNLogConfig).
  • - The log level.
  • - A string literal.
  • - XML event description compatible with log4j, Chainsaw and NLogViewer.
  • - The logger name.
  • - The date and time in a long, sortable format yyyy-MM-dd HH:mm:ss.ffff.
  • - The machine name that the process is running on.
  • - Mapped Diagnostics Context - a thread-local structure.
  • - Async Mapped Diagnostics Context - a thread-local structure.
  • - The formatted log message.
  • - Nested Diagnostics Context - a thread-local structure.
  • - A newline literal.
  • - The directory where NLog.dll is located.
  • - The performance counter.
  • - The identifier of the current process.
  • - The information about the running process.
  • - The name of the current process.
  • - The process time in format HH:mm:ss.mmm.
  • - High precision timer, based on the value returned from QueryPerformanceCounter() optionally converted to seconds.
  • - A value from the Registry.
  • - The short date in a sortable format yyyy-MM-dd.
  • - Information about Silverlight application.
  • - System special folder path (includes My Documents, My Music, Program Files, Desktop, and more).
  • - Stack trace renderer.
  • - A temporary directory.
  • - The identifier of the current thread.
  • - The name of the current thread.
  • - The Ticks value of current date and time.
  • - The time in a 24-hour, sortable format HH:mm:ss.mmm.
  • - Render variable (new in 4.1)
  • - Thread Windows identity information (username).

Wrappers

  • - Applies caching to another layout output.
  • - Filters characters not allowed in the file names by replacing them with safe character.
  • - Escapes output of another layout using JSON rules.
  • - Converts the result of another layout output to lower case.
  • - Only outputs the inner layout when exception has been defined for log message.
  • - Applies padding to another layout output.
  • - Replaces a string in the output of another layout with another string.
  • - Replaces newline characters with another string.
  • - Decodes text "encrypted" with ROT-13.
  • - Trims the whitespace from the result of another layout renderer.
  • - Converts the result of another layout output to upper case.
  • - Encodes the result of another layout output for use with URLs.
  • - Only outputs the inner layout when the specified condition has been met.
  • - Outputs alternative layout when the inner layout produces empty result.
  • - Wraps the result of another layout output at specified line length.
  • - Converts the result of another layout output to be XML-compliant.

NLog.Extended package 

  • - App config setting.

NLog.Web package

  • - ASP.NET MVC action name
  • - ASP.NET MVC controller name
  • - ASP.NET Application variable.
  • - ASP.NET HttpContext item variable.
  • - ASP.NET trace identifier
  • - ASP.NET Request variable.
  • - ASP.NET Request cookie content.
  • - ASP.NET Request host.
  • - ASP.NET Request method (GET, POST etc).
  • - ASP.NET Request querystring.
  • - ASP.NET Request referrer.
  • - ASP.NET Request useragent.
  • - ASP.NET Request URL.
  • - ASP.NET Session variable.
  • - ASP.NET Session ID variable.
  • - ASP.NET User auth.
  • - ASP.NET User variable.
  • - IIS site name.

External packages

External packages, not maintained by the NLog team.

  • - Converts log to format.

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 . You can pass your own values in code by adding custom properties to the event. You then retrieve the value using the renderer. See the documentation for the for an example.

转载地址:http://uslta.baihongyu.com/

你可能感兴趣的文章
Docker容器启动报WARNING: IPv4 forwarding is disabled. Networking will not work
查看>>
(转)第三方支付参与者
查看>>
程序员修炼之道读后感2
查看>>
DWR实现服务器向客户端推送消息
查看>>
js中forEach的用法
查看>>
Docker之功能汇总
查看>>
!!a标签和button按钮只允许点击一次,防止重复提交
查看>>
(轉貼) Eclipse + CDT + MinGW 安裝方法 (C/C++) (gcc) (g++) (OS) (Windows)
查看>>
还原数据库
查看>>
作业调度框架 Quartz.NET 2.0 beta 发布
查看>>
mysql性能的检查和调优方法
查看>>
项目管理中的导向性
查看>>
Android WebView 学习
查看>>
(转)从给定的文本中,查找其中最长的重复子字符串的问题
查看>>
HDU 2159
查看>>
spring batch中用到的表
查看>>
资源文件夹res/raw和assets的使用
查看>>
UINode扩展
查看>>
LINUX常用命令
查看>>
百度云盘demo
查看>>