How to get rid of “\” in Nlog messages?log4net vs. NlogHow to configure a default target in NLogHow to get path of current target file using NLog in runtime?NLog auto truncate messagesusing Nlog and writing to file as jsonLog custom web request headers with NLogNLog: logging an object serialized to JSONNLog with enableArchiveFileCompression doesn't workNLog DB ConfigurationNLog and ElasticSearch in ASP.NET Core
What is -(-2,3,4)?
Non-inverting amplifier ; Single supply ; Bipolar input
C++20 with u8, char8_t and std::string?
Why did moving the mouse cursor cause Windows 95 to run more quickly?
What instances can be solved today by modern solvers (pure LP)?
Fine-tuning parameters for existing methods
How can solar sailed ships be protected from space debris?
Does this circuit have marginal voltage level problem?
Does a reference have a storage location?
What is a "tittering order"?
German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)
Term for a character that only exists to be talked to
"Best practices" for formulating MIPs
When should we use dependency injection (C#)
Solving Equations with HeavisideTheta Functions
What caused the flashes in the video footage of Chernobyl?
How come having a Deathly Hallow is not a big deal?
Has there ever been a cold war other than between the U.S. and the U.S.S.R.?
Bypass with wrong cvv of debit card and getting OTP
3D nonogram – What's going on?
Why is the saxophone not common in classical repertoire?
What could a Medieval society do with excess animal blood?
Use real text instead of lipsum in moderncv quote alignment
How can I know (without going to the station) if RATP is offering the Anti Pollution tickets?
How to get rid of “\” in Nlog messages?
log4net vs. NlogHow to configure a default target in NLogHow to get path of current target file using NLog in runtime?NLog auto truncate messagesusing Nlog and writing to file as jsonLog custom web request headers with NLogNLog: logging an object serialized to JSONNLog with enableArchiveFileCompression doesn't workNLog DB ConfigurationNLog and ElasticSearch in ASP.NET Core
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm using Nlog to log messages to Elasticsearch. The messages often contain file path names. Nlog seems to escape the "" character in every file path and I want to avoid that. The encode="false" attribute doesn't work with the "field" tag used to configure the Elasticsearch target. Is there any other way to store a file path without the extra ""?
add a comment |
I'm using Nlog to log messages to Elasticsearch. The messages often contain file path names. Nlog seems to escape the "" character in every file path and I want to avoid that. The encode="false" attribute doesn't work with the "field" tag used to configure the Elasticsearch target. Is there any other way to store a file path without the extra ""?
` Nlog seems to escape the "" character in every file path`, not sure about that. Could you please post an example? (config and logger calls)
– Julian
Mar 27 at 21:51
add a comment |
I'm using Nlog to log messages to Elasticsearch. The messages often contain file path names. Nlog seems to escape the "" character in every file path and I want to avoid that. The encode="false" attribute doesn't work with the "field" tag used to configure the Elasticsearch target. Is there any other way to store a file path without the extra ""?
I'm using Nlog to log messages to Elasticsearch. The messages often contain file path names. Nlog seems to escape the "" character in every file path and I want to avoid that. The encode="false" attribute doesn't work with the "field" tag used to configure the Elasticsearch target. Is there any other way to store a file path without the extra ""?
asked Mar 25 at 17:57
aspdevaspdev
359 bronze badges
359 bronze badges
` Nlog seems to escape the "" character in every file path`, not sure about that. Could you please post an example? (config and logger calls)
– Julian
Mar 27 at 21:51
add a comment |
` Nlog seems to escape the "" character in every file path`, not sure about that. Could you please post an example? (config and logger calls)
– Julian
Mar 27 at 21:51
` Nlog seems to escape the "" character in every file path`, not sure about that. Could you please post an example? (config and logger calls)
– Julian
Mar 27 at 21:51
` Nlog seems to escape the "" character in every file path`, not sure about that. Could you please post an example? (config and logger calls)
– Julian
Mar 27 at 21:51
add a comment |
1 Answer
1
active
oldest
votes
I've searched through the docs more thoroughly and come across the Replace Layout Renderer. Here is what appears to be working in my case:
<variable name="replacedstring" value="$replace:searchFor=\:wholeWords=false:replaceWith=/:regex=false:inner=$message" />
You simply define the variable in the Nlog.config file and use it where you'd normally use the layout containing the pre-modified string (the inner attribute). I hope that's what I was looking for. I was also wondering if it is possible to define multiple patterns within the same variable. For example,we want to replace "" with "/" and at the same time we want to replace "rn" with "-" across the same inner string. Does anyone know if that is possible using this particular renderer? The docs say nothing about it.
For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer
– Rolf Kristensen
Mar 30 at 0:18
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343882%2fhow-to-get-rid-of-in-nlog-messages%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I've searched through the docs more thoroughly and come across the Replace Layout Renderer. Here is what appears to be working in my case:
<variable name="replacedstring" value="$replace:searchFor=\:wholeWords=false:replaceWith=/:regex=false:inner=$message" />
You simply define the variable in the Nlog.config file and use it where you'd normally use the layout containing the pre-modified string (the inner attribute). I hope that's what I was looking for. I was also wondering if it is possible to define multiple patterns within the same variable. For example,we want to replace "" with "/" and at the same time we want to replace "rn" with "-" across the same inner string. Does anyone know if that is possible using this particular renderer? The docs say nothing about it.
For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer
– Rolf Kristensen
Mar 30 at 0:18
add a comment |
I've searched through the docs more thoroughly and come across the Replace Layout Renderer. Here is what appears to be working in my case:
<variable name="replacedstring" value="$replace:searchFor=\:wholeWords=false:replaceWith=/:regex=false:inner=$message" />
You simply define the variable in the Nlog.config file and use it where you'd normally use the layout containing the pre-modified string (the inner attribute). I hope that's what I was looking for. I was also wondering if it is possible to define multiple patterns within the same variable. For example,we want to replace "" with "/" and at the same time we want to replace "rn" with "-" across the same inner string. Does anyone know if that is possible using this particular renderer? The docs say nothing about it.
For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer
– Rolf Kristensen
Mar 30 at 0:18
add a comment |
I've searched through the docs more thoroughly and come across the Replace Layout Renderer. Here is what appears to be working in my case:
<variable name="replacedstring" value="$replace:searchFor=\:wholeWords=false:replaceWith=/:regex=false:inner=$message" />
You simply define the variable in the Nlog.config file and use it where you'd normally use the layout containing the pre-modified string (the inner attribute). I hope that's what I was looking for. I was also wondering if it is possible to define multiple patterns within the same variable. For example,we want to replace "" with "/" and at the same time we want to replace "rn" with "-" across the same inner string. Does anyone know if that is possible using this particular renderer? The docs say nothing about it.
I've searched through the docs more thoroughly and come across the Replace Layout Renderer. Here is what appears to be working in my case:
<variable name="replacedstring" value="$replace:searchFor=\:wholeWords=false:replaceWith=/:regex=false:inner=$message" />
You simply define the variable in the Nlog.config file and use it where you'd normally use the layout containing the pre-modified string (the inner attribute). I hope that's what I was looking for. I was also wondering if it is possible to define multiple patterns within the same variable. For example,we want to replace "" with "/" and at the same time we want to replace "rn" with "-" across the same inner string. Does anyone know if that is possible using this particular renderer? The docs say nothing about it.
edited Mar 25 at 22:24
answered Mar 25 at 21:59
aspdevaspdev
359 bronze badges
359 bronze badges
For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer
– Rolf Kristensen
Mar 30 at 0:18
add a comment |
For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer
– Rolf Kristensen
Mar 30 at 0:18
For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer
– Rolf Kristensen
Mar 30 at 0:18
For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer
– Rolf Kristensen
Mar 30 at 0:18
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343882%2fhow-to-get-rid-of-in-nlog-messages%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
` Nlog seems to escape the "" character in every file path`, not sure about that. Could you please post an example? (config and logger calls)
– Julian
Mar 27 at 21:51