c# - Process Id not coming in log4net log file name -


I am trying to keep process ID information in my log file name so that every time a new log file is created. The application has started again. I am entering the same file with two projects, it is my config.

  & lt; Configuration & gt; & Lt; ConfigSections & gt; & Lt; Section name = "log4net" type = "log4net.config.loginNetConfigurationSectionHandler, log4net" /> & Lt; / ConfigSections & gt; & Lt; Log4net & gt; & Lt; Appender name = "newlogfireiverment" type = "log4net .apper. Rolling file appleper" & gt; & Lt; File value = "c: \\ test leg \\ two projects - [% processid] .txt" /> & Lt; Layout type = "log4net.Layout.PatternLayout" & gt; & Lt; Conversion pattern value = "% d [% t]% -5p% c -% m% n" / & gt; & Lt; / Layout & gt; & Lt; / Appender & gt; & Lt; Logger name = "class library 1" & gt; & Lt; Level value = "ERROR" /> & Lt; Max file size value = "256 KB" /> & Lt; Param name = "threshold" value = "error" /> & Lt; Epander-reef ref = "newlogfireiverment" /> & Lt; / Logger & gt; & Lt; Logger name = "classbary 2" & gt; & Lt; Level value = "ERROR" /> & Lt; Max file size value = "256 KB" /> & Lt; Param name = "threshold" value = "error" /> & Lt; Epander-reef ref = "newlogfireiverment" /> & Lt; / Logger & gt; & Lt; / Log4net & gt; & Lt; / Configuration & gt;   

I'm referring to % processid to get process ID information in the log file name, but when the application runs, this log file name TwoProjects - [% ProcessID] .txt . Actual process id is not shown in filename. What could be the reason for this?

By default, unless you specify, your file value is not parsed That there is a pattern in it.

The solution is to change the line

  & lt; File value = "c: \\ testlogs \\ two projects - [% processid] .txt" / & gt;   

  & lt; File type = "log4net.Util.PatternString" value = "c: \\ test leg \\ two projects - [% processid] .txt" />    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -