posted by 네코냥이
2013. 11. 22. 09:37
Layout Renderers · NLog_NLog Wiki · GitHub.pdf
Layout Renderers
Layout renderers are macros that are used in Layouts.
Layout Renderers
- ${asp-application} - ASP Application variable.
- ${aspnet-application} - ASP.NET Application 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.
- ${asp-request} - ASP Request variable.
- ${asp-session} - ASP Session variable.
- ${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).
- ${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-context} - Log event context data.
- ${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. Provided for compatibility with log4net.
- ${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.mmm.
- ${machinename} - The machine name that the process is running on.
- ${mdc} - Mapped Diagnostic Context item. Provided for compatibility with log4net.
- ${message} - The formatted log message.
- ${ndc} - Nested Diagnostic Context item. Provided for compatibility with log4net.
- ${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.
- ${windows-identity} - Thread Windows identity information (username).
Wrapper Layout Renderers
- ${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.
- ${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.
- ${xml-encode} - Converts the result of another layout output to be XML-compliant.
Custom Layout Renderers
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-context}renderer. See the documentation for the ${event-context} for an example.
Last edited by Slowpython,
'메모' 카테고리의 다른 글
Nexus 7 - Android 4.3 - bootloader problem (0) | 2013.11.24 |
---|---|
NLog - Configuration file (0) | 2013.11.22 |
Windows Forms Event LifeCycle (0) | 2013.11.20 |
닷넷의 resx파일 (System.Resources)에 대한 간략적인 설명 (0) | 2013.11.20 |
C# XML 파싱 (0) | 2013.11.19 |