mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
[knx] Improve logging for serial gateways (#17793)
* Logger in SerialAdapter respects the log setting for the binding. * Additional warning if open port is detected. Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
parent
336875797b
commit
7b1c44547e
@ -74,7 +74,7 @@ public class SerialTransportAdapter implements SerialCom {
|
||||
if (portId == null) {
|
||||
throw new IOException("Port not available");
|
||||
}
|
||||
logger = LoggerFactory.getLogger("SerialTransportAdapter:" + portId);
|
||||
logger = LoggerFactory.getLogger(SerialTransportAdapter.class.getName() + ":" + portId);
|
||||
|
||||
final @Nullable SerialPortManager tmpSerialPortManager = serialPortManager;
|
||||
if (tmpSerialPortManager == null) {
|
||||
@ -83,6 +83,10 @@ public class SerialTransportAdapter implements SerialCom {
|
||||
try {
|
||||
SerialPortIdentifier portIdentifier = tmpSerialPortManager.getIdentifier(portId);
|
||||
if (portIdentifier != null) {
|
||||
if (portIdentifier.isCurrentlyOwned()) {
|
||||
logger.warn("Configured port {} is currently in use by another application: {}", portId,
|
||||
portIdentifier.getCurrentOwner());
|
||||
}
|
||||
logger.trace("Trying to open port {}", portId);
|
||||
SerialPort serialPort = portIdentifier.open(this.getClass().getName(), OPEN_TIMEOUT_MS);
|
||||
// apply default settings for com port, may be overwritten by caller
|
||||
|
Loading…
Reference in New Issue
Block a user