Better formatting authored by Gianluca Chiozzi's avatar Gianluca Chiozzi
[[_TOC_]] [[_TOC_]]
### KB: No cpp/python from ICD \[ICD waf build\] ### No cpp/python from ICD \[ICD waf build\]
**Problem** **Problem**
...@@ -27,7 +27,7 @@ declare_project(name='mytests', ...@@ -27,7 +27,7 @@ declare_project(name='mytests',
``` ```
### KB: Mock OLDB for unit tests \[cpp\] ### Mock OLDB for unit tests \[cpp\]
...@@ -99,7 +99,7 @@ Example in <https://gitlab.eso.org/ahoffsta/cii-srv/-/blob/oldb-in-memory-missin ...@@ -99,7 +99,7 @@ Example in <https://gitlab.eso.org/ahoffsta/cii-srv/-/blob/oldb-in-memory-missin
### KB: Catching API Exceptions \[Python\] ### Catching API Exceptions \[Python\]
...@@ -196,7 +196,7 @@ This question was originally asked in [ECII-422](https://jira.eso.org/browse/ECI ...@@ -196,7 +196,7 @@ This question was originally asked in [ECII-422](https://jira.eso.org/browse/ECI
### KB: access_key empty (DevEnv 3.2.0) \[OLDB\] ### access_key empty (DevEnv 3.2.0) \[OLDB\]
...@@ -244,7 +244,7 @@ The problem will be fixed in DevEnv 3.4. ...@@ -244,7 +244,7 @@ The problem will be fixed in DevEnv 3.4.
### KB: Datapoint already exists \[OLDB\] ### Datapoint already exists \[OLDB\]
...@@ -407,7 +407,7 @@ This is a potentially very invasive operation. Please contact us for instruction ...@@ -407,7 +407,7 @@ This is a potentially very invasive operation. Please contact us for instruction
### KB: Req/Rep Connection Listeners \[MAL Python\] ### Req/Rep Connection Listeners \[MAL Python\]
...@@ -424,7 +424,7 @@ This is done with the method "*registerConnectionListener()*". ...@@ -424,7 +424,7 @@ This is done with the method "*registerConnectionListener()*".
Given the example below, this does not work, and the "*listenerMethod()"* is never called. Given the example below, this does not work, and the "*listenerMethod()"* is never called.
```
import sys import sys
import datetime import datetime
import signal import signal
...@@ -462,7 +462,7 @@ connectionFuture.wait_for(THREE_SECONDS) ...@@ -462,7 +462,7 @@ connectionFuture.wait_for(THREE_SECONDS)
rtn = stdcmds.Status() rtn = stdcmds.Status()
rtn.wait() rtn.wait()
print( str(rtn.get() )) print( str(rtn.get() ))
```
*From \<<https://jira.eso.org/browse/ECII-212>\>* *From \<<https://jira.eso.org/browse/ECII-212>\>*
...@@ -502,7 +502,7 @@ Remember to delete (assign None), to this object when closing the connection to ...@@ -502,7 +502,7 @@ Remember to delete (assign None), to this object when closing the connection to
### KB: Command Line Tools and Python snippets \[OLDB\] ### Command Line Tools and Python snippets \[OLDB\]
...@@ -579,7 +579,7 @@ Python 3.7.6 (default, Jan 8 2020, 19:59:22)</p><p>[GCC 7.3.0] :: Anaconda, Inc. ...@@ -579,7 +579,7 @@ Python 3.7.6 (default, Jan 8 2020, 19:59:22)</p><p>[GCC 7.3.0] :: Anaconda, Inc.
### KB: Latency on Pub/Sub \[MAL ZMQ\] ### Latency on Pub/Sub \[MAL ZMQ\]
...@@ -642,7 +642,7 @@ The problem lies in the ZMQ send queues. Default size is 1000 and with 144MB per ...@@ -642,7 +642,7 @@ The problem lies in the ZMQ send queues. Default size is 1000 and with 144MB per
### KB: Choose middlewares to build \[MAL ICD\] ### Choose middlewares to build \[MAL ICD\]
...@@ -695,7 +695,7 @@ The available options are: ...@@ -695,7 +695,7 @@ The available options are:
### KB: Sending an array of unions \[MAL cpp\] ### Sending an array of unions \[MAL cpp\]
...@@ -811,7 +811,7 @@ This issue was first described in [ECII-154](https://jira.eso.org/browse/ECII-15 ...@@ -811,7 +811,7 @@ This issue was first described in [ECII-154](https://jira.eso.org/browse/ECII-15
### KB: config not found on remote db \[Conf\] ### config not found on remote db \[Conf\]
...@@ -899,7 +899,7 @@ To that end, the error message is misleading, and should be improved (ticket [EC ...@@ -899,7 +899,7 @@ To that end, the error message is misleading, and should be improved (ticket [EC
### KB: Failed to send request, send queue full \[CII MAL\] ### Failed to send request, send queue full \[CII MAL\]
...@@ -933,7 +933,7 @@ Probably you have called close() on the CiiConfigClient instance somewhere, mayb ...@@ -933,7 +933,7 @@ Probably you have called close() on the CiiConfigClient instance somewhere, mayb
### KB: Getting More Logs \[MAL\] ### Getting More Logs \[MAL\]
**Problem** **Problem**
...@@ -941,20 +941,98 @@ The MAL seems to misbehave. How can I get more log messages from the MAL used in ...@@ -941,20 +941,98 @@ The MAL seems to misbehave. How can I get more log messages from the MAL used in
**Solution A** **Solution A**
Java **Java**
From MAL 1.1.0, edit the MAL log4j config xml and specify the MAL log levels: From MAL 1.1.0, edit the MAL log4j config xml and specify the MAL log levels:
| \<Logger name="elt.mal" level="TRACE" /> | ```
|------------------------------------------| <Logger name="elt.mal" level="TRACE" />
```
Cpp **Cpp**
Example for **Zpb.** For other middlewares, see below Example for **Zpb.** For other middlewares, see below
1. Put a log-config file into your file system: 1. Put a log-config file into your file system:
<table><colgroup><col style="width: 78%" /><col style="width: 21%" /></colgroup><thead><tr class="header"><th><p>log4cplus.rootLogger=TRACE, stdout</p><p> </p><p>log4cplus.logger.malDds=TRACE, MyFileAppender</p><p>log4cplus.logger.malDdsBasePubSub=TRACE, MyFileAppender</p><p>log4cplus.logger.malDdsPublisher=TRACE, MyFileAppender</p><p>log4cplus.logger.malDdsInstancePublisher=TRACE, MyFileAppender</p><p>log4cplus.logger.malDdsSubscriptionManager=TRACE, MyFileAppender</p><p>log4cplus.logger.malDdsSubscriptionReaderListener=TRACE, MyFileAppender</p><p>log4cplus.logger.malDdsSubscriber=TRACE, MyFileAppender</p><p>log4cplus.logger.malDdsMrvSubscriber=TRACE, MyFileAppender</p><p>log4cplus.logger.malDdsRequesterImpl=TRACE, MyFileAppender</p><p> </p><p>log4cplus.additivity.malDds=True</p><p>log4cplus.additivity.malDdsBasePubSub=True</p><p>log4cplus.additivity.malDdsPublisher=True</p><p>log4cplus.additivity.malDdsInstancePublisher=True</p><p>log4cplus.additivity.malDdsSubscriptionManager=True</p><p>log4cplus.additivity.malDdsSubscriptionReaderListener=True</p><p>log4cplus.additivity.malDdsSubscriber=True</p><p>log4cplus.additivity.malDdsMrvSubscriber=True</p><p>log4cplus.additivity.malDdsRequesterImpl=True</p><p> </p><p> </p><p>log4cplus.logger.malZpb=TRACE, MyFileAppender</p><p>log4cplus.logger.malZpbBasePubSub=TRACE, MyFileAppender</p><p>log4cplus.logger.malZpbPublisher=TRACE, MyFileAppender</p><p>log4cplus.logger.malZpbInstancePublisher=TRACE, MyFileAppender</p><p>log4cplus.logger.malZpbSubscriber=TRACE, MyFileAppender</p><p>log4cplus.logger.malZpbMrvSubscriber=TRACE, MyFileAppender</p><p>log4cplus.logger.malZpbServer=TRACE, MyFileAppender</p><p>log4cplus.logger.malZpbClientAsyncImpl=TRACE, MyFileAppender</p><p> </p><p>log4cplus.additivity.malZpb=True</p><p>log4cplus.additivity.malZpbBasePubSub=True</p><p>log4cplus.additivity.malZpbPublisher=True</p><p>log4cplus.additivity.malZpbInstancePublisher=True</p><p>log4cplus.additivity.malZpbSubscriber=True</p><p>log4cplus.additivity.malZpbMrvSubscriber=True</p><p>log4cplus.additivity.malZpbServer=True</p><p>log4cplus.additivity.malZpbClientAsyncImpl=True</p><p> </p><p> </p><p>log4cplus.logger.malOpcua=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaBasePubSub=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaPublisher=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaInstancePublisher=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaSubscriber=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaMrvSubscriber=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaMrvDataMonitor=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaDataPoller=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaDataMonitor=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaClient=TRACE, MyFileAppender</p><p>log4cplus.logger.malOpcuaClientEventLoop=TRACE, MyFileAppender</p><p> </p><p>log4cplus.additivity.malOpcua=True</p><p>log4cplus.additivity.malOpcuaBasePubSub=True</p><p>log4cplus.additivity.malOpcuaPublisher=True</p><p>log4cplus.additivity.malOpcuaInstancePublisher=True</p><p>log4cplus.additivity.malOpcuaSubscriber=True</p><p>log4cplus.additivity.malOpcuaMrvSubscriber=True</p><p>log4cplus.additivity.malOpcuaMrvDataMonitor=True</p><p>log4cplus.additivity.malOpcuaDataPoller=True</p><p>log4cplus.additivity.malOpcuaDataMonitor=True</p><p>log4cplus.additivity.malOpcuaClient=True</p><p>log4cplus.additivity.malOpcuaClientEventLoop=True</p><p> </p><p> </p><p>log4cplus.appender.stdout=log4cplus::ConsoleAppender</p><p>log4cplus.appender.stdout.layout=log4cplus::PatternLayout</p><p>log4cplus.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n</p><p> </p><p>log4cplus.appender.MyFileAppender=log4cplus::RollingFileAppender</p><p>log4cplus.appender.MyFileAppender.File=/tmp/elt-mal-cpp-trace.log</p><p>log4cplus.appender.MyFileAppender.layout=log4cplus::PatternLayout</p><p>log4cplus.appender.MyFileAppender.layout.ConversionPattern=[%-5p][%D{%Y/%m/%d %H:%M:%S:%q}][%-l][%t] %m%n</p></th><th><p> </p><p>&lt;&lt;mal-log4cplus.conf&gt;&gt;</p><p> </p></th></tr></thead><tbody></tbody></table> ```
log4cplus.rootLogger=TRACE, stdout
log4cplus.logger.malDds=TRACE, MyFileAppender
log4cplus.logger.malDdsBasePubSub=TRACE, MyFileAppender
log4cplus.logger.malDdsPublisher=TRACE, MyFileAppender
log4cplus.logger.malDdsInstancePublisher=TRACE, MyFileAppender
log4cplus.logger.malDdsSubscriptionManager=TRACE, MyFileAppender
log4cplus.logger.malDdsSubscriptionReaderListener=TRACE, MyFileAppender
log4cplus.logger.malDdsSubscriber=TRACE, MyFileAppender
log4cplus.logger.malDdsMrvSubscriber=TRACE, MyFileAppender
log4cplus.logger.malDdsRequesterImpl=TRACE, MyFileAppender
log4cplus.additivity.malDds=True
log4cplus.additivity.malDdsBasePubSub=True
log4cplus.additivity.malDdsPublisher=True
log4cplus.additivity.malDdsInstancePublisher=True
log4cplus.additivity.malDdsSubscriptionManager=True
log4cplus.additivity.malDdsSubscriptionReaderListener=True
log4cplus.additivity.malDdsSubscriber=True
log4cplus.additivity.malDdsMrvSubscriber=True
log4cplus.additivity.malDdsRequesterImpl=True
log4cplus.logger.malZpb=TRACE, MyFileAppender
log4cplus.logger.malZpbBasePubSub=TRACE, MyFileAppender
log4cplus.logger.malZpbPublisher=TRACE, MyFileAppender
log4cplus.logger.malZpbInstancePublisher=TRACE, MyFileAppender
log4cplus.logger.malZpbSubscriber=TRACE, MyFileAppender
log4cplus.logger.malZpbMrvSubscriber=TRACE, MyFileAppender
log4cplus.logger.malZpbServer=TRACE, MyFileAppender
log4cplus.logger.malZpbClientAsyncImpl=TRACE, MyFileAppender
log4cplus.additivity.malZpb=True
log4cplus.additivity.malZpbBasePubSub=True
log4cplus.additivity.malZpbPublisher=True
log4cplus.additivity.malZpbInstancePublisher=True
log4cplus.additivity.malZpbSubscriber=True
log4cplus.additivity.malZpbMrvSubscriber=True
log4cplus.additivity.malZpbServer=True
log4cplus.additivity.malZpbClientAsyncImpl=True
log4cplus.logger.malOpcua=TRACE, MyFileAppender
log4cplus.logger.malOpcuaBasePubSub=TRACE, MyFileAppender
log4cplus.logger.malOpcuaPublisher=TRACE, MyFileAppender
log4cplus.logger.malOpcuaInstancePublisher=TRACE, MyFileAppender
log4cplus.logger.malOpcuaSubscriber=TRACE, MyFileAppender
log4cplus.logger.malOpcuaMrvSubscriber=TRACE, MyFileAppender
log4cplus.logger.malOpcuaMrvDataMonitor=TRACE, MyFileAppender
log4cplus.logger.malOpcuaDataPoller=TRACE, MyFileAppender
log4cplus.logger.malOpcuaDataMonitor=TRACE, MyFileAppender
log4cplus.logger.malOpcuaClient=TRACE, MyFileAppender
log4cplus.logger.malOpcuaClientEventLoop=TRACE, MyFileAppender
log4cplus.additivity.malOpcua=True
log4cplus.additivity.malOpcuaBasePubSub=True
log4cplus.additivity.malOpcuaPublisher=True
log4cplus.additivity.malOpcuaInstancePublisher=True
log4cplus.additivity.malOpcuaSubscriber=True
log4cplus.additivity.malOpcuaMrvSubscriber=True
log4cplus.additivity.malOpcuaMrvDataMonitor=True
log4cplus.additivity.malOpcuaDataPoller=True
log4cplus.additivity.malOpcuaDataMonitor=True
log4cplus.additivity.malOpcuaClient=True
log4cplus.additivity.malOpcuaClientEventLoop=True
log4cplus.appender.stdout=log4cplus::ConsoleAppender
log4cplus.appender.stdout.layout=log4cplus::PatternLayout
log4cplus.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4cplus.appender.MyFileAppender=log4cplus::RollingFileAppender
log4cplus.appender.MyFileAppender.File=/tmp/elt-mal-cpp-trace.log
log4cplus.appender.MyFileAppender.layout=log4cplus::PatternLayout
log4cplus.appender.MyFileAppender.layout.ConversionPattern=[%-5p][%D{%Y/%m/%d %H:%M:%S:%q}][%-l][%t] %m%n
```
2. Pass the path to the log-config to MAL: 2. Pass the path to the log-config to MAL:
...@@ -962,18 +1040,26 @@ MAL logging is initialized from a configuration file, the path of which is read ...@@ -962,18 +1040,26 @@ MAL logging is initialized from a configuration file, the path of which is read
For example: For example:
<table><colgroup><col style="width: 100%" /></colgroup><thead><tr class="header"><th><p>auto zpbMal = mal::loadMal("zpb",</p><p>mal::Mal::Properties{{mal::PROP_LOG_CONFIG_FILENAME,"/path/to/mal-log4cplus.conf"}}</p><p>);</p></th></tr></thead><tbody></tbody></table> ```
auto zpbMal = mal::loadMal("zpb",
mal::Mal::Properties{{mal::PROP_LOG_CONFIG_FILENAME,"/path/to/mal-log4cplus.conf"}}
);
```
or in python: or in **python:**
<table><colgroup><col style="width: 100%" /></colgroup><thead><tr class="header"><th><p>import elt.pymal as mal</p><p>zpbMal = mal.loadMal ("zpb",</p><p>{"zpb.log4cplus.filename":"/path/to/mal-log4cplus.conf"})</p></th></tr></thead><tbody></tbody></table> ```
import elt.pymal as mal
zpbMal = mal.loadMal ("zpb", {"zpb.log4cplus.filename":"/path/to/mal-log4cplus.conf"})
```
**Solution B** **Solution B**
With [ECII-246](https://jira.eso.org/browse/ECII-246), it is possible to change the log levels of the MAL loggers at run-time via a method call: With [ECII-246](https://jira.eso.org/browse/ECII-246), it is possible to change the log levels of the MAL loggers at run-time via a method call:
```
::elt::mal::util::logging::setLogLevelForLoggers( ... ) ::elt::mal::util::logging::setLogLevelForLoggers( ... )
```
The allowed logger names are listed below. The allowed logger names are listed below.
**Background** **Background**
...@@ -982,7 +1068,7 @@ MAL does not use the Cii Logging System (CiiLogManager etc.) directly. Instead, ...@@ -982,7 +1068,7 @@ MAL does not use the Cii Logging System (CiiLogManager etc.) directly. Instead,
List of logger names available in the **Cpp MAL / Python MAL:** List of logger names available in the **Cpp MAL / Python MAL:**
Loggers for mal-zpb Loggers for **mal-zpb**
- malZpbInstancePublisher - malZpbInstancePublisher
...@@ -1000,7 +1086,7 @@ Loggers for mal-zpb ...@@ -1000,7 +1086,7 @@ Loggers for mal-zpb
- malZpbBasePubSub - malZpbBasePubSub
Loggers for mal-dds Loggers for **mal-dds**
- malDds - malDds
...@@ -1020,7 +1106,7 @@ Loggers for mal-dds ...@@ -1020,7 +1106,7 @@ Loggers for mal-dds
- malDdsInstancePublisher - malDdsInstancePublisher
Loggers for mal-opcua Loggers for **mal-opcua**
- malOpcua - malOpcua
...@@ -1044,79 +1130,39 @@ Loggers for mal-opcua ...@@ -1044,79 +1130,39 @@ Loggers for mal-opcua
- malOpcuaClientEventLoop - malOpcuaClientEventLoop
### KB: Change Log Levels at Run-time ### Change Log Levels at Run-time
**Problem** **Problem**
I want to modify the log levels of my application programmatically, without having to reload the full log configuration.
I want to modify the log levels of my application programmatically,
without having to reload the full log configuration.
**Solution** **Solution**
With [ECII-282](https://jira.eso.org/browse/ECII-282), the CiiLogManager was extended in all three languages to allow dynamically change log levels.
With [ECII-282](https://jira.eso.org/browse/ECII-282), the CiiLogManager was extended in all three languages.
**C++** added methods:
C++ added methods: ```
void elt::log::CiiLogManager::SetLogLevel(const std::string logger_name, log4cplus::LogLevel level)
> void elt::log::CiiLogManager::SetLogLevel(log4cplus::Logger logger, log4cplus::LogLevel level)
> ```
> void elt::log::CiiLogManager::SetLogLevel(const std::string logger_name, log4cplus::LogLevel level)
>
>
>
> void elt::log::CiiLogManager::SetLogLevel(log4cplus::Logger logger, log4cplus::LogLevel level)
Java added methods:
>
>
> void elt.log.CiiLogManager.setLogLevel(
>
> final String loggerName, final org.apache.logging.log4j.Level level);
>
>
>
> void elt.log.CiiLogManager.setLogLevel(
>
> org.apache.logging.log4j.Logger logger, final org.apache.logging.log4j.Level level)
Python added methods:
> **Java** added methods:
>
> elt.log.CiiLogManager.set_log_level(name_or_logger: Union\[str, logging.Logger\], level: logging.Level)
```
void elt.log.CiiLogManager.setLogLevel(
final String loggerName, final org.apache.logging.log4j.Level level);
void elt.log.CiiLogManager.setLogLevel(
org.apache.logging.log4j.Logger logger, final org.apache.logging.log4j.Level level)
```
**Python** added methods:
```
elt.log.CiiLogManager.set_log_level(name_or_logger: Union\[str, logging.Logger\], level: logging.Level)
```
### PYBIND errors \[ICD waf build\]
### KB: PYBIND errors \[ICD waf build\]
...@@ -1162,7 +1208,7 @@ In general, due to the many code generation steps taking place, your freedom in ...@@ -1162,7 +1208,7 @@ In general, due to the many code generation steps taking place, your freedom in
### KB: multiple XMLs found \[ICD waf build\] ### multiple XMLs found \[ICD waf build\]
...@@ -1223,7 +1269,7 @@ For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#K ...@@ -1223,7 +1269,7 @@ For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#K
### KB: g++: internal compiler error: Killed \[waf build\] ### g++: internal compiler error: Killed \[waf build\]
...@@ -1331,7 +1377,7 @@ rm -f /swapfile  </th></tr></thead><tbody></tbody></table> ...@@ -1331,7 +1377,7 @@ rm -f /swapfile  </th></tr></thead><tbody></tbody></table>
### KB: More Frames expected \[CII MAL ZMQ\] ### More Frames expected \[CII MAL ZMQ\]
...@@ -1401,7 +1447,7 @@ In the above example, e.g.: ...@@ -1401,7 +1447,7 @@ In the above example, e.g.:
### KB: Address in use \[CII MAL ZMQ\] ### Address in use \[CII MAL ZMQ\]
...@@ -1471,7 +1517,7 @@ The error message is in fact misleading. ...@@ -1471,7 +1517,7 @@ The error message is in fact misleading.
### KB: Scheme not supported \[CII MAL\] ### Scheme not supported \[CII MAL\]
...@@ -1515,7 +1561,7 @@ The middleware is supported in fact, but failed to load. ...@@ -1515,7 +1561,7 @@ The middleware is supported in fact, but failed to load.
### KB: Choosing a NIC \[CII MAL DDS\] ### Choosing a NIC \[CII MAL DDS\]
...@@ -1561,7 +1607,7 @@ Therefore, this boils down to configuring DDS. ...@@ -1561,7 +1607,7 @@ Therefore, this boils down to configuring DDS.
### KB: Configuring DDS \[CII MAL DDS\] ### Configuring DDS \[CII MAL DDS\]
...@@ -1626,7 +1672,7 @@ iii\) pass 2 keys to the MAL factory, so DDS finds the right profile in the XML ...@@ -1626,7 +1672,7 @@ iii\) pass 2 keys to the MAL factory, so DDS finds the right profile in the XML
### KB: Variable Tracking exceeded \[CII MAL\] ### Variable Tracking exceeded \[CII MAL\]
...@@ -1696,7 +1742,7 @@ def configure(cnf): ...@@ -1696,7 +1742,7 @@ def configure(cnf):
### KB: Multithreading in Java ### Multithreading in Java
...@@ -1712,7 +1758,7 @@ The document is available on the web: ...@@ -1712,7 +1758,7 @@ The document is available on the web:
### KB: Summary of OPC/UA MAL in C++ ### Summary of OPC/UA MAL in C++
... ...
......