From: Randy MacLeod <randy.macleod@windriver.com>
To: joe.slater@windriver.com, openembedded-core@lists.openembedded.org
Subject: Re: [oe-core][PATCH 1/1] runqemu: add some logging control
Date: Wed, 2 Aug 2023 20:45:26 -0400 [thread overview]
Message-ID: <09448132-5fa3-0f6f-ed2c-ac3ae52e9e04@windriver.com> (raw)
In-Reply-To: <20230802233626.3642612-1-joe.slater@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 1484 bytes --]
On 2023-08-02 19:36, joe.slater@windriver.com wrote:
> From: Joe Slater<joe.slater@windriver.com>
>
> Use QB_LOG_FILE to log to a file, and QB_LOG_LEVEL
> to set the base log level. Example values -
>
> QB_LOG_FILE="runq.log"
> QB_LOG_LEVEL=DEBUG
>
> Signed-off-by: Joe Slater<joe.slater@windriver.com>
> ---
> scripts/runqemu | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index 5e6793d44e..bea164d041 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -36,12 +36,20 @@ runqemu, i.e. `runqemu /path/to/my-image-name.qemuboot.conf`\n\n %s" % message)
>
> def create_logger():
> logger = logging.getLogger('runqemu')
> - logger.setLevel(logging.INFO)
> + try:
> + logger.setLevel(os.getenv("QB_LOG_LEVEL"))
> + except:
> + logger.setLevel(logging.INFO)
>
> - # create console handler and set level to debug
> - ch = logging.StreamHandler()
> - ch.setLevel(logging.DEBUG)
Better to keep the log level the same or call out the change in the
short/long log.
../Randy
>
> + # create a handler and set level to debug
> + try:
> + ch = logging.FileHandler(os.getenv("QB_LOG_FILE"))
> + except:
> + ch = logging.StreamHandler()
> +
> + ch.setLevel(logging.DEBUG)
> +
> # create formatter
> formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')
>
--
# Randy MacLeod
# Wind River Linux
[-- Attachment #2: Type: text/html, Size: 2261 bytes --]
prev parent reply other threads:[~2023-08-03 0:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 23:36 [oe-core][PATCH 1/1] runqemu: add some logging control joe.slater
2023-08-03 0:45 ` Randy MacLeod [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09448132-5fa3-0f6f-ed2c-ac3ae52e9e04@windriver.com \
--to=randy.macleod@windriver.com \
--cc=joe.slater@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox