On 9/3/2013 3:35 AM, Ramakrishna S wrote:
Is there any replacement to print process id and process name(%P and %N) in 
log4cxx?


I don't think there is process id and name in log4cxx since it is patterned after log4j where the name would be java or java.exe and the normal API doesn't give you it's process ID. I didn't notice a conversion for it under any of the PatternLayout conversion characters.

I'm not as up-to-date on log4cxx as I ought to be, but if the MDC (mapped diagnostic context) is supported in your version, you can configure key/value pairs for your "ProcessID" and "ProcessName" using C library calls to get the values early in the program startup, and then set your logging format to use %X{ProcessID} and %X{ProcessName}.

--
Jacob Anawalt
Gecko Software, Inc.
janaw...@geckosoftware.com
435-752-8026

Reply via email to