-
Notifications
You must be signed in to change notification settings - Fork 0
Network target
Sends log messages over the network.
For SOAP-based webservice support over HTTP use WebService target.
Supported in .NET, Silverlight, Compact Framework and Mono. ##Configuration Syntax
<targets>
<target xsi:type="Network"
name="String"
onOverflow="Enum"
newLine="Boolean"
lineEnding="CRLF|LF|CR|None"
layout="Layout"
maxMessageSize="Integer"
encoding="Encoding"
connectionCacheSize="Integer"
maxConnections="Integer"
maxQueueSize="Integer"
keepConnection="Boolean"
onConnectionOverflow="Enum"
address="Layout"
/>
</targets>
Read more about using the Configuration File.
##Parameters
###General Options
name - Name of the target.
###Layout Options
onOverflow - Action that should be taken if the message is larger than maxMessageSize.
Possible values:
- Discard - Discard the entire message.
- Error - Report an error.
- Split - Split the message into smaller pieces.
newLine - Indicates whether to append newline at the end of log message. Boolean Default: False
layout - Layout used to format log messages. Layout Required. Default: ${longdate}|${level:uppercase=true}|${logger}|${message}
maxMessageSize - Maximum message size in bytes. Integer Default: 65000
encoding - Encoding to be used. Encoding Default: utf-8
lineEnding - Line Ending to be used if newLine is set to true. LineEndingMode
Default: CRLF
. Not used if newLine is false
. Introduced in 4.3.8.
Possible values:
- CRLF - Carriage Return and Line Feed. (default)
- CR - Carriage Return.
- LF - Line Feed.
- None - No end of line characters.
###Connection Options connectionCacheSize - Size of the connection cache (number of connections which are kept alive). Integer Default: 5
keepConnection - Indicates whether to keep connection open whenever possible. Not used for stateless protocols (= http, https) Boolean Default: True
maxConnections - Maximum current connections. 0 = no maximum. Integer
Default: 0
. Not used if keepConnection is true
. Introduced in NLog 4.2.1
onConnectionOverflow - Action that should be taken if the will be more connections than maxConnections . Introduced in NLog 4.2.1. Possible values:
- AllowNewConnnection - Just allow it. (default)
- Block - Block until there's more room in the queue.
- DiscardMessage - Discard the connection item.
maxQueueSize - Maximum queue size. Only used for TCP (not http/https/udp). Will removes messages when if too many. 0 is no max. Integer
. Default: 0
address - Network address. Layout
The network address can be:
- tcp://host:port - TCP (auto select IPv4/IPv6) (not supported on Windows Phone 7.0)
- tcp4://host:port - force TCP/IPv4 (not supported on Windows Phone 7.0)
- tcp6://host:port - force TCP/IPv6 (not supported on Windows Phone 7.0)
- udp://host:port - UDP (auto select IPv4/IPv6, not supported on Silverlight and on Windows Phone 7.0)
- udp4://host:port - force UDP/IPv4 (not supported on Silverlight and on Windows Phone 7.0)
- udp6://host:port - force UDP/IPv6 (not supported on Silverlight and on Windows Phone 7.0)
- http://host:port/pageName - HTTP using POST verb
- https://host:port/pageName - HTTPS using POST verb
- Search in documentation
- Getting started
- Examples
- External articles and tutorials
- FAQ
- Platform support
- Advanced Configuration file options
- Filtering log messages
- [Using Time Sources](Time Source)
- Visual Studio support
- Who is using NLog
- [Write custom extensions](Extending NLog)