Return-Path: Delivered-To: apmail-logging-log4cxx-user-archive@www.apache.org Received: (qmail 83639 invoked from network); 13 Jun 2006 18:02:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jun 2006 18:02:29 -0000 Received: (qmail 79926 invoked by uid 500); 13 Jun 2006 18:02:28 -0000 Delivered-To: apmail-logging-log4cxx-user-archive@logging.apache.org Received: (qmail 79904 invoked by uid 500); 13 Jun 2006 18:02:28 -0000 Mailing-List: contact log4cxx-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4CXX User" List-Id: Delivered-To: mailing list log4cxx-user@logging.apache.org Received: (qmail 79893 invoked by uid 99); 13 Jun 2006 18:02:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jun 2006 11:02:28 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.35.35.7] (HELO mailgw3a.lmco.com) (192.35.35.7) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jun 2006 11:02:26 -0700 Received: from emss09g01.ems.lmco.com (relay6.ems.lmco.com [166.17.13.59])by mailgw3a.lmco.com (LM-6) with ESMTP id k5DI24ZI001440for ; Tue, 13 Jun 2006 14:02:04 -0400 (EDT) Received: from CONVERSION-DAEMON.lmco.com by lmco.com (PMDF V6.1-1X6 #30875) id <0J0T005018OV38@lmco.com> for log4cxx-user@logging.apache.org; Tue, 13 Jun 2006 14:02:04 -0400 (EDT) Received: from EMSS09I00.us.lmco.com ([158.183.26.31]) by lmco.com (PMDF V6.1-1X6 #30875) with ESMTP id <0J0T007AG8FQ7C@lmco.com> for log4cxx-user@logging.apache.org; Tue, 13 Jun 2006 13:55:02 -0400 (EDT) Received: from EMSS09M04.us.lmco.com ([158.183.152.13]) by EMSS09I00.us.lmco.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 13 Jun 2006 13:55:02 -0400 Date: Tue, 13 Jun 2006 13:55:01 -0400 From: "Steck, David" Subject: RE: how to get the process ID from PatternLayout To: Log4CXX User Message-id: MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft Exchange V6.0.6603.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-Topic: how to get the process ID from PatternLayout Thread-Index: AcaO36ZCtqZ2mySkRTulgPa2O39JKAAL7BTQ content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: X-OriginalArrivalTime: 13 Jun 2006 17:55:02.0605 (UTC) FILETIME=[7ECAEFD0:01C68F12] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Just as an idea, you could push the process ID onto the NDC (or MDC) after you fork(), then display it with %x (or %X) in your pattern. -David david.steck@lmco.com P.S. For anyone who knows: Looking at the documentation for MDC, why does the C++ log4cxx MDC require JDK 1.2? Is that mistakenly copied from log4j? -----Original Message----- From: Dizzy [mailto:dizzy@roedu.net] Sent: Tuesday, June 13, 2006 7:50 AM To: log4cxx-user@logging.apache.org Subject: how to get the process ID from PatternLayout Hi I am using log4cxx for some multithreaded AND multiprocess programs (I fork() on big operations, I spawn thread using boost::thread on per operation tasks). For threads "%t" seems to work fine as it uniquely identifies the thread but for processes it seems that "%t" displays the same thing for all processes forked from the same parent, like I have this output from a test program: $ ./log4cxxtest DEBUG 2006-06-13 11:31:26,455 (2812696064 testApp) message1 DEBUG 2006-06-13 11:31:26,457 (2812693424 testApp) newthread: message2 DEBUG 2006-06-13 11:31:26,457 (2812696064 testApp) oldthread: message2 DEBUG 2006-06-13 11:31:26,458 (2812696064 testApp) child: message3 DEBUG 2006-06-13 11:31:26,458 (2812696064 testApp) parent: message3 Where 2812696064 and 2812693424 are what %t displays. So... how can I display something to identify the process using PatternLayout ? Thanks! -- Mihai RUSU Email: dizzy@roedu.net GPG : http://dizzy.roedu.net/dizzy-gpg.txt WWW: http://dizzy.roedu.net "Linux is obsolete" -- AST