You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2024/07/07 09:32:13 UTC

(couchdb) branch run-logs-dir-2 created (now 91f014355)

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a change to branch run-logs-dir-2
in repository https://gitbox.apache.org/repos/asf/couchdb.git


      at 91f014355 print log dir on dev/run startup

This branch includes the following new commits:

     new 91f014355 print log dir on dev/run startup

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(couchdb) 01/01: print log dir on dev/run startup

Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch run-logs-dir-2
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 91f014355bb1db56c7a542527b4d4aad8f247714
Author: Robert Newson <Ro...@ibm.com>
AuthorDate: Sun Jul 7 10:31:53 2024 +0100

    print log dir on dev/run startup
---
 dev/run | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/dev/run b/dev/run
index f5ee9c04c..ffa74a503 100755
--- a/dev/run
+++ b/dev/run
@@ -100,7 +100,7 @@ def setup():
     opts, args = setup_argparse()
     ctx = setup_context(opts, args)
     setup_logging(ctx)
-    setup_dirs(ctx)
+    setup_log_dir(log_dir(ctx))
     check_beams(ctx)
     check_boot_script(ctx)
     setup_configs(ctx)
@@ -307,10 +307,12 @@ def setup_context(opts, args):
     }
 
 
-@log("Setup environment")
-def setup_dirs(ctx):
-    ensure_dir_exists(ctx["devdir"], "logs")
+@log("Setup log dir: {log_dir}")
+def setup_log_dir(log_dir):
+    ensure_dir_exists(log_dir)
 
+def log_dir(ctx):
+    return os.path.join(ctx["devdir"], "logs")
 
 def ensure_dir_exists(root, *segments):
     path = os.path.join(root, *segments)
@@ -525,7 +527,7 @@ def boot_haproxy(ctx):
         return
     config = os.path.join(ctx["devdir"], "lib", "haproxy.cfg")
     cmd = [ctx["haproxy"], "-f", config]
-    logfname = os.path.join(ctx["devdir"], "logs", "haproxy.log")
+    logfname = os.path.join(log_dir(ctx), "haproxy.log")
     log = open(logfname, "w")
     env = os.environ.copy()
     if "HAPROXY_PORT" not in env:
@@ -547,7 +549,7 @@ def boot_nouveau(ctx):
         "--args",
         f"server '{config}'",
     ]
-    logfname = os.path.join(ctx["devdir"], "logs", "nouveau.log")
+    logfname = os.path.join(log_dir(ctx), "nouveau.log")
     log = open(logfname, "w")
     return sp.Popen(
         cmd,
@@ -642,7 +644,7 @@ def boot_clouseau(ctx, idx):
                 "Java is not suitable to run Clouseau.  Please use JRE 1.7 or 1.8 and configure its (root) path in `CLOUSEAU_JAVA_HOME`"
             )
 
-    logfname = os.path.join(ctx["devdir"], "logs", "clouseau{}.log".format(idx))
+    logfname = os.path.join(log_dir(ctx), "clouseau{}.log".format(idx))
     log = open(logfname, "w")
     separator = ";" if platform.system() == "Windows" else ":"
 
@@ -1015,7 +1017,7 @@ def boot_node(ctx, node):
         mode = "wb"
     else:
         mode = "r+b"
-    logfname = os.path.join(ctx["devdir"], "logs", "%s.log" % node)
+    logfname = os.path.join(log_dir(ctx), "%s.log" % node)
     log = open(logfname, mode)
     if "extra_args" in ctx and ctx["extra_args"]:
         cmd += ctx["extra_args"].split(" ")