Julian Verdurmen edited this page Aug 18, 2018 · 11 revisions

Layouts are one of the attributes of most targets. The layout attribute is used to determine the format of the information to be logged. Many pre-defined 'macros' or Layout renderers exist. In the below example ${machinename} is an example of a layout renderer.

Default Layout

If a target has the layout attribute, you may define a custom layout. If you do not specify a layout, the default layout is used. The default layout is:


Pre-Defined Layouts

Several pre-defined layouts exist:

All layouts could be found here:


An example of a simple layout looks like:

layout="${machinename} ${message}"

This layout is used in the NLog.config file like:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="" 

        <target name="console" xsi:type="ColoredConsole" 
                layout="${machinename} ${message}"/>

        <logger name="*" minlevel="Trace" writeTo="console" />
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.