From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.cs.Stanford.EDU (smtp1.cs.stanford.edu [171.64.64.25]) by dpdk.org (Postfix) with ESMTP id 80125DE3 for ; Thu, 15 Sep 2016 02:52:42 +0200 (CEST) Received: from mail-it0-f44.google.com ([209.85.214.44]:36285) by smtp1.cs.Stanford.EDU with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bkKuu-0005JO-Ve for users@dpdk.org; Wed, 14 Sep 2016 17:52:41 -0700 Received: by mail-it0-f44.google.com with SMTP id o3so71948040ita.1 for ; Wed, 14 Sep 2016 17:52:40 -0700 (PDT) X-Gm-Message-State: AE9vXwPaahvMIIMDHKD/aXJGN04qPdJxxOkhFveRBkbWrxcqL4gmWbxuaR1JaFtSAM8dGE9lnnW3VNTYdyhxEg== X-Received: by 10.107.30.11 with SMTP id e11mr11090405ioe.57.1473900760640; Wed, 14 Sep 2016 17:52:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.211.199 with HTTP; Wed, 14 Sep 2016 17:52:00 -0700 (PDT) In-Reply-To: <20160914212457.GA6972@mhcomputing.net> References: <20160914212457.GA6972@mhcomputing.net> From: John Ousterhout Date: Wed, 14 Sep 2016 17:52:00 -0700 X-Gmail-Original-Message-ID: Message-ID: To: Matthew Hall Cc: users@dpdk.org X-Spam-Score: -1.0 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin on smtp1.cs.Stanford.EDU X-Scan-Signature: 2ecb59bd28923317bd193fe54b7794cd Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-users] Redirect DPDK log? X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 00:52:42 -0000 At first I thought this approach (fmemopen) might work, but now I'm not so sure. The problem is that fmemopen doesn't provide any sort of notification when it adds data to the buffer. My application can use a polling approach where it occasionally checks to see if data has been added, but this has a serious flaw. Some of the DPDK functions, such as rte_eal_init, can panic in the face of severe errors: they write information to the log and then exit the application. In a situation like this, the application will not have a chance to check for the log messages and relay them onto the appropriate place, so the log data will be dropped and the application will exit without leaving behind any information about what happened. If there were a way to intercept calls to rte_panic, then I could take that opportunity to flush information from the fmemopen buffer, but I don't see a way to do that...? -John- On Wed, Sep 14, 2016 at 2:24 PM, Matthew Hall wrote: > On Wed, Sep 14, 2016 at 02:08:27PM -0700, John Ousterhout wrote: > > Is there a mechanism in DPDK that can interpose on the log output? I see > > the function rte_openlog_stream to specify a different FILE* for output, > > but that isn't quite general enough. I'd like for a method in my > > application to receive all of the log messages, so I can wrap them > > appropriately and then add them to an application-specific log. Does > such a > > hooking mechanism exist? > > http://www.gnu.org/software/libc/manual/html_node/String-Streams.html > > Matthew. >