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

baunsgaard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/main by this push:
     new 3b18f06fc8 [MINOR] log4j prop Python systemds Context
3b18f06fc8 is described below

commit 3b18f06fc850f659929ad9a04dbc2e19933a4677
Author: Sebastian Baunsgaard <[email protected]>
AuthorDate: Fri Jan 5 18:42:16 2024 +0100

    [MINOR] log4j prop Python systemds Context
    
    Default to LOG4JPROP environment variable for the log file settings
    in python
    
    Closes #1976
---
 .../python/systemds/context/systemds_context.py     | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/main/python/systemds/context/systemds_context.py 
b/src/main/python/systemds/context/systemds_context.py
index 4cbc6a464d..5f34086807 100644
--- a/src/main/python/systemds/context/systemds_context.py
+++ b/src/main/python/systemds/context/systemds_context.py
@@ -183,16 +183,19 @@ class SystemDSContext(object):
 
         command.append(classpath)
 
-        files = glob(os.path.join(root, "conf", "log4j*.properties"))
-        if len(files) > 1:
-            self._log.warning(
-                "Multiple logging files found selecting: " + files[0])
-        if len(files) == 0:
-            self._log.warning("No log4j file found at: "
-                              + os.path.join(root, "conf")
-                              + " therefore using default settings")
+        if os.environ.get("LOG4JPROP") == None:
+            files = glob(os.path.join(root, "conf", "log4j*.properties"))
+            if len(files) > 1:
+                self._log.warning(
+                    "Multiple logging files found selecting: " + files[0])
+            if len(files) == 0:
+                self._log.warning("No log4j file found at: "
+                                  + os.path.join(root, "conf")
+                                  + " therefore using default settings")
+            else:
+                command.append("-Dlog4j.configuration=file:" + files[0])
         else:
-            command.append("-Dlog4j.configuration=file:" + files[0])
+            command.append("-Dlog4j.configuration=file:" 
+os.environ.get("LOG4JPROP"))
 
         command.append("org.apache.sysds.api.PythonDMLScript")
 

Reply via email to