[{"id":23214,"web_url":"https://patchwork.libcamera.org/comment/23214/","msgid":"<d9a40627-5c40-587e-d644-4ca44e5f15d8@ideasonboard.com>","date":"2022-05-29T11:32:51","subject":"Re: [libcamera-devel] [PATCH 3/5] libcamera: base: log: Log to\n\tstd::cerr if log file can't be opened","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hello,\n\nThank you for the patch.\n\nOn 5/26/22 00:25, Laurent Pinchart via libcamera-devel wrote:\n> If the log file specified through LIBCAMERA_LOG_FILE can't be opened,\n> logging is currently completely disabled. This doesn't match the\n> documented behaviour that tells std::cerr is used instead. Fix it to\n> match the documentation.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   src/libcamera/base/log.cpp | 6 +++---\n>   1 file changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> index 9ae62368a54d..26f1420703b9 100644\n> --- a/src/libcamera/base/log.cpp\n> +++ b/src/libcamera/base/log.cpp\n> @@ -517,6 +517,8 @@ void Logger::logSetLevel(const char *category, const char *level)\n>    */\n>   Logger::Logger()\n>   {\n> +\tlogSetStream(&std::cerr);\n> +\n>   \tparseLogFile();\n>   \tparseLogLevels();\n>   }\n> @@ -533,10 +535,8 @@ Logger::Logger()\n>   void Logger::parseLogFile()\n>   {\n>   \tconst char *file = utils::secure_getenv(\"LIBCAMERA_LOG_FILE\");\n> -\tif (!file) {\n> -\t\tlogSetStream(&std::cerr);\n> +\tif (!file)\n>   \t\treturn;\n> -\t}\n>   \n>   \tif (!strcmp(file, \"syslog\")) {\n>   \t\tlogSetTarget(LoggingTargetSyslog);","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9825ABD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 29 May 2022 11:32:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0409065633;\n\tSun, 29 May 2022 13:32:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A309A60415\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 29 May 2022 13:32:55 +0200 (CEST)","from [192.168.1.68] (235.red-81-36-186.dynamicip.rima-tde.net\n\t[81.36.186.235])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 344C76DC;\n\tSun, 29 May 2022 13:32:55 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653823977;\n\tbh=F5ff/YeGc5+RV0hsx7I17WA/mI6wEEyMCUQMSMn/quw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=vUecU7DNLDzQNCgr9NWi8hBitxxDu5DnrPB/Q5YA8PY3qcf6pqoZirPb1uSetc93X\n\tKt6TycvoN1fT0KmAuSy0LEHo7yN/OsQi5uYp3N4YttbAu0D+7ihWvTCZcvGgXTpmLK\n\t+qLyRcyxRo6ZHEY5QGgVUpRaxtCzgFTrrIWuX24GJgkxBbK99aG8oeKvUJTjH+ZFDH\n\tGn1JeKvY8b2fdag+fB2xuskXU4qoixuONPPT3uURwfDD/9ZIoaEyd1Et/am5VWHhSO\n\tfSdQXawCxhoNusUJ7VqOloQD4yUgZ2+rGY4bhCRGYTaOUfa6Saws3YEup8LBxcOTe4\n\ti5esIAPHQYORA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653823975;\n\tbh=F5ff/YeGc5+RV0hsx7I17WA/mI6wEEyMCUQMSMn/quw=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=IYetfACWOKJK4qcAXbeh2Nlj5ELF4TFWmdWRKGoGJjiwEHfhGxFTfoZb2E7qc7lo3\n\tBcI6e2xRR5be1KHauQ4+egD5Ffb63EV+TRLkc9rhYUb3WHa1T4hkZpyEtH3lwYB+zb\n\tiZF+HrLI5GraMt3EZLB2/ZA5e04yZ3JHbxi8oGZA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"IYetfACW\"; dkim-atps=neutral","Message-ID":"<d9a40627-5c40-587e-d644-4ca44e5f15d8@ideasonboard.com>","Date":"Sun, 29 May 2022 13:32:51 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220525222503.6460-1-laurent.pinchart@ideasonboard.com>\n\t<20220525222503.6460-4-laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20220525222503.6460-4-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 3/5] libcamera: base: log: Log to\n\tstd::cerr if log file can't be opened","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23259,"web_url":"https://patchwork.libcamera.org/comment/23259/","msgid":"<20220531032909.GF2630765@pyrite.rasen.tech>","date":"2022-05-31T03:29:09","subject":"Re: [libcamera-devel] [PATCH 3/5] libcamera: base: log: Log to\n\tstd::cerr if log file can't be opened","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Laurent,\n\nOn Thu, May 26, 2022 at 01:25:01AM +0300, Laurent Pinchart via libcamera-devel wrote:\n> If the log file specified through LIBCAMERA_LOG_FILE can't be opened,\n> logging is currently completely disabled. This doesn't match the\n> documented behaviour that tells std::cerr is used instead. Fix it to\n> match the documentation.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/libcamera/base/log.cpp | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> index 9ae62368a54d..26f1420703b9 100644\n> --- a/src/libcamera/base/log.cpp\n> +++ b/src/libcamera/base/log.cpp\n> @@ -517,6 +517,8 @@ void Logger::logSetLevel(const char *category, const char *level)\n>   */\n>  Logger::Logger()\n>  {\n> +\tlogSetStream(&std::cerr);\n> +\n>  \tparseLogFile();\n>  \tparseLogLevels();\n>  }\n> @@ -533,10 +535,8 @@ Logger::Logger()\n>  void Logger::parseLogFile()\n>  {\n>  \tconst char *file = utils::secure_getenv(\"LIBCAMERA_LOG_FILE\");\n> -\tif (!file) {\n> -\t\tlogSetStream(&std::cerr);\n> +\tif (!file)\n>  \t\treturn;\n> -\t}\n>  \n>  \tif (!strcmp(file, \"syslog\")) {\n>  \t\tlogSetTarget(LoggingTargetSyslog);","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0E87ABD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 31 May 2022 03:29:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4405F65633;\n\tTue, 31 May 2022 05:29:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A35026040A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 May 2022 05:29:17 +0200 (CEST)","from pyrite.rasen.tech (softbank036240126034.bbtec.net\n\t[36.240.126.34])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 30ABB6F0;\n\tTue, 31 May 2022 05:29:15 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653967759;\n\tbh=vRSJwwXSFqnCkBojhbMXHMc5f0K17rb/tYkk7+H/mYQ=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=I8nfy3/IUnYSD5hFTPOm2B2YggPK3JoZFVxKrVS/Mc583ZzpICJ5Xlx0N2iekxVkn\n\tkU1Hu0X2e4f7CKqTLzFeXBJTGDMXQAfBKx30xOtCePq+eupTxqJ1wWo0LEn9dm5xna\n\tvCSidNexw0+PINJdHEWe4l0V5g2jxAteFxTB0CJK2jkRmCvkFSOOv5FLMj1H68FxMA\n\t0cBq1Bq/EAYjiKR+h1UU300O8YJIGx5IUDMv762XGrLpbNuPmMAAfU8dTxn9AxuSDV\n\tw9I2gxvUw+WbYmfASVdQvyJ/QbCpqQbupBAlln6lh5on48Xrr7msajWNN9ObzYwQCh\n\t56r6BpDKMA1bA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653967757;\n\tbh=vRSJwwXSFqnCkBojhbMXHMc5f0K17rb/tYkk7+H/mYQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=TnHo5wNgbEP7usy6tzMmJVhtAh4aOy62JxcXAB7Aha04ooGWYl4lUsfmUrN0YwV+9\n\toZAamHafE8GtWoO9V6zR2UgBB5SELioR2bYHGD+jqV8uURwGc2VRk72LGyTmrdlxnd\n\tFauL0bBGnODLL1shcqkO5e+2WWfbmh1pPmIO2UQ4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"TnHo5wNg\"; dkim-atps=neutral","Date":"Tue, 31 May 2022 12:29:09 +0900","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220531032909.GF2630765@pyrite.rasen.tech>","References":"<20220525222503.6460-1-laurent.pinchart@ideasonboard.com>\n\t<20220525222503.6460-4-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20220525222503.6460-4-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/5] libcamera: base: log: Log to\n\tstd::cerr if log file can't be opened","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"paul.elder@ideasonboard.com","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]