From: Vincent Hanquez Date: Mon, 20 Jul 2009 09:54:59 +0000 (+0100) Subject: allow to set debug with a environment variable X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2b257a6c56d4fc35c28deb9aabd3cff4d888d450;p=xenclient%2Ftoolstack.git allow to set debug with a environment variable --- diff --git a/xenvm/xenvm.ml b/xenvm/xenvm.ml index ec01fc9..27033b3 100644 --- a/xenvm/xenvm.ml +++ b/xenvm/xenvm.ml @@ -783,12 +783,19 @@ let () = if !daemonize then Unixext.daemonize (); - if state.vm_cfg.debug then ( + let glob_debug = try Some (Sys.getenv "XENVM_DEBUG") with Not_found -> None in + if state.vm_cfg.debug || glob_debug <> None then ( let a = - if state.vm_cfg.output = "" then - sprintf "file:/tmp/xenvm-debug-%s" uuid - else - "file:/" ^ state.vm_cfg.output + if state.vm_cfg.debug then ( + if state.vm_cfg.output = "" then + sprintf "file:/tmp/xenvm-debug-%s" uuid + else + "file:/" ^ state.vm_cfg.output + ) else ( + match glob_debug with + | None -> assert false + | Some dbg -> dbg + ) in Logs.set_default Log.Debug [ a ]; Logs.set_default Log.Info [ a ];