logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob L. Anawalt" <janaw...@geckosoftware.com>
Subject Re: ConversionPattern to print process id and name in log4cxx
Date Wed, 04 Sep 2013 16:12:39 GMT
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.

View raw message