8000 Environment layout renderer · NLog/NLog Wiki · GitHub
[go: up one dir, main page]

Skip to content

Environment layout renderer

Rolf Kristensen edited this page Mar 15, 2025 · 13 revisions

The environment variable like USERNAME, TMP, USERPROFILE, COMPUTERNAME, PROCESSOR_ARCHITECTURE etc.

Platforms Supported: All

Configuration Syntax

${environment:variable=String}

Parameters

Rendering Options

  • variable - Name of the environment variable. Required. Examples: USERNAME, TMP, USERPROFILE, COMPUTERNAME, PROCESSOR_ARCHITECTURE etc.

Remarks

  • For better performance then consider to combine with cached=true. Thus only resolving environment-variable value only once, but then not react to any changes of the environment variable.

  • This Layout Renderer outputs environment variables, and NOT properties from System.Environment

  • To list all environment variables in your system:

Example

log file for 32 bits systems in folder 32 and otherwise in folder 64

<target 
   xsi:type="File"
   name="file1" 
   fileName="c:\temp\${when:when='${environment:PROCESSOR_ARCHITECTURE:cached=true}'='X86':inner=32:else=64}\file.log" />
Clone this wiki locally
0