From 2892211f5cb8460e647497ce0c6e618e84afaa3e Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 15 Jun 2021 04:11:01 +0200
Subject: [PATCH] L2SS-244: Configure logging to actually see log lines in
 'docker logs device-xyz'

---
 devices/APSCTL.py     | 5 +++++
 devices/PCC.py        | 5 +++++
 devices/SDP.py        | 5 +++++
 devices/SNMP.py       | 5 +++++
 devices/Statistics.py | 5 +++++
 5 files changed, 25 insertions(+)

diff --git a/devices/APSCTL.py b/devices/APSCTL.py
index b9d476808..068ec2ab4 100644
--- a/devices/APSCTL.py
+++ b/devices/APSCTL.py
@@ -187,6 +187,11 @@ class APSCTL(hardware_device):
 # ----------
 def main(args=None, **kwargs):
     """Main function of the SDP module."""
+
+    from util.lofar_logging import configure_logger
+    import logging
+    configure_logger(logging.getLogger())
+
     return run((APSCTL,), args=args, **kwargs)
 
 
diff --git a/devices/PCC.py b/devices/PCC.py
index 37acfc1d3..e8eb9bc94 100644
--- a/devices/PCC.py
+++ b/devices/PCC.py
@@ -243,6 +243,11 @@ class PCC(hardware_device):
 # ----------
 def main(args=None, **kwargs):
     """Main function of the PCC module."""
+
+    from util.lofar_logging import configure_logger
+    import logging
+    configure_logger(logging.getLogger())
+
     return run((PCC,), args=args, **kwargs)
 
 
diff --git a/devices/SDP.py b/devices/SDP.py
index 09a8c809a..56091d98b 100644
--- a/devices/SDP.py
+++ b/devices/SDP.py
@@ -167,6 +167,11 @@ class SDP(hardware_device):
 # ----------
 def main(args=None, **kwargs):
     """Main function of the SDP module."""
+
+    from util.lofar_logging import configure_logger
+    import logging
+    configure_logger(logging.getLogger())
+
     return run((SDP,), args=args, **kwargs)
 
 
diff --git a/devices/SNMP.py b/devices/SNMP.py
index db748639e..eb90b2768 100644
--- a/devices/SNMP.py
+++ b/devices/SNMP.py
@@ -110,6 +110,11 @@ class SNMP(hardware_device):
 # ----------
 def main(args=None, **kwargs):
     """Main function of the PCC module."""
+
+    from util.lofar_logging import configure_logger
+    import logging
+    configure_logger(logging.getLogger())
+
     return run((SNMP,), args=args, **kwargs)
 
 
diff --git a/devices/Statistics.py b/devices/Statistics.py
index 0c0b5ad73..659832287 100644
--- a/devices/Statistics.py
+++ b/devices/Statistics.py
@@ -99,6 +99,11 @@ class Statistics(hardware_device):
 # ----------
 def main(args=None, **kwargs):
     """Main function of the Statistics Device module."""
+
+    from util.lofar_logging import configure_logger
+    import logging
+    configure_logger(logging.getLogger())
+
     return run((Statistics,), args=args, **kwargs)
 
 
-- 
GitLab