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;








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 ""?










share|improve this question






















  • ` 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

















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 ""?










share|improve this question






















  • ` 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













0












0








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 ""?










share|improve this question














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 ""?







elasticsearch nlog






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • ` 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












1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer

























  • For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer

    – Rolf Kristensen
    Mar 30 at 0:18










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
);



);













draft saved

draft discarded


















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









0














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.






share|improve this answer

























  • For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer

    – Rolf Kristensen
    Mar 30 at 0:18















0














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.






share|improve this answer

























  • For newlines you can checkout: github.com/NLog/NLog/wiki/Replace-NewLines-Layout-Renderer

    – Rolf Kristensen
    Mar 30 at 0:18













0












0








0







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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








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

















  • 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








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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해