简体   繁体   中英

c# NLog local-ip cached

I read that with NLog 4.6.8 there is a layout to acquire the local IP address and, for better performance, use a cached ip value.

I'm using a layout like this:

 <target xsi:type="Network"
       ...
       ...
       layout="SrcIP:${local-ip:cached:true}, ${message}"/>

but I'm not sure this is the correct syntax, as the documentation is not very clear to me.
Can anyone tell me if this syntax is correct or not? If not, how should I cache ip indefinitely?
Thanks so much

Thanks to Rolf Kristensen

The correct syntax is:

${local-ip:cached=true}

Now it works well and the Warn message local-ip has no default property in the internal NLog log is disappeared. Thank you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM