Solo5 / solo5

A sandboxed execution environment for unikernels
ISC License
898 stars 139 forks source link

solo5 should respect `mirage configure --logs=LEVEL` #161

Closed ricarkol closed 6 years ago

ricarkol commented 7 years ago

solo5 is not respecting the --logs argument to mirage configure and we end up with a lot of output on stdout that's not always useful for an app developer (specially if you want to pipe the actual app output to something else). Ideally all of the following should be avoided if mirage is configured with --logs=error.

            |      ___|
  __|  _ \  |  _ \ __ \
\__ \ (   | | (   |  ) |
____/\___/ _|\___/____/
Solo5: Memory map: 512 MB addressable:
Solo5:     unused @ (0x0 - 0xfffff)
Solo5:       text @ (0x100000 - 0x33bfff)
Solo5:     rodata @ (0x33c000 - 0x3b5fff)
Solo5:       data @ (0x3b6000 - 0x53afff)
Solo5:       heap >= 0x53b000 < stack < 0x20000000
Solo5: Clock source: KVM paravirtualized clock
Solo5: new bindings
STUB: getenv() called
STUB: open() called
STUB: getpid() called
STUB: getppid() called
{"code":200,"body":"Thread-11247\n",...}
Solo5: solo5_app_main() returned with 0

These logs are coming from solo5, mirage-solo5 ("new bindings"), and ocaml-freestanding ("STUB:").

mato commented 7 years ago

On Wednesday, 01.03.2017 at 07:29, Ricardo Koller wrote:

solo5 is not respecting the --logs argument to mirage configure and we end up with a lot of output on stdout that's not always useful for an app developer (specially if you want to pipe the output to something else). Ideally all of the following should be avoided if mirage is configured with --logs=error.

I don't think this can easily be integrated with the mirage tool, but I would do at least the following:

1) Replace all Solo5-internal calls to printf(...) with, say, log(important, ...). Add a "static int log_verbose = 0", and only have log() print if "log_verbose || important" is true.

2) Implement some way to toggle log_verbose at runtime w/o recompilation. This is annoying, since we currently pass all of the command line to solo5_app_main(). One way would be to look for a "solo5:verbose" token at the start, if present then eat it and set verbose.

So, the default would be "silence", which is fine, and if the user runs into issues then they'd be asked to pass "solo5:verbose" on the command line.

What do you think?

-mato

ricarkol commented 7 years ago

Hi mato, I think that works. Will work on a PR for solo5.

Do you think the logs coming from ocaml-freestanding could be removed? these:

STUB: getenv() called
STUB: open() called
STUB: getpid() called
STUB: getppid() called
"STUB:" + xxx + "called"
mato commented 7 years ago

On Thursday, 02.03.2017 at 20:34, Ricardo Koller wrote:

Hi mato, I think that works. Will work on a PR for solo5.

Do you think the logs coming from ocaml-freestanding could be removed? these:


STUB: getenv() called
STUB: open() called
STUB: getpid() called
STUB: getppid() called
"STUB:" + xxx + "called"

Yeah, I can kill those.

mato commented 6 years ago

Scope as defined in https://github.com/Solo5/solo5/issues/161#issuecomment-283792229 is done, so closing.