如何保存用于侦听并打印当前活动的NetworkManager命令的输出?
命令是nmcli monitor
(https://developer.gnome.org/NetworkManager/stable/nmcli.html)。
答案 0 :(得分:0)
我将展示如何通过NetworkManager修改日志记录级别。
NetworkManager支持即时更改日志记录级别,并允许对记录的内容进行精细控制。
root@hostname ~: nmcli general logging
LEVEL DOMAINS INFO PLATFORM,RFKILL,ETHER,WIFI,BT,MB,DHCP4,DHCP6,PPP,IP4,IP6,AUTOIP4,DNS,VPN,SHARING,SUPPLICANT,AGENTS,SETTINGS,SUSPEND,CORE,DEVICE,OLPC,INFINIBAND,FIREWALL,ADSL,BOND,VLAN,BRIDGE,TEAM,CONCHECK,DCB,DISPATCH,AUDIT,SYSTEMD
nmcli general logging [level <level> [domain <domain>]]
ERR :将仅记录严重错误
警告 :将记录警告消息
INFO :将记录各种参考消息
调试 :出于调试目的启用详细日志记录
<域> 是应以给定严重性记录的消息类别。
WIFI :仅包含与WiFi相关的消息,IP4仅包含与IPv4相关的消息
以此类推,我无法提供所有设置的信息,但这通常是这样的。
journalctl -u NetworkManager > tomyfile.txt
sudo /usr/lib/NetworkManager/debug-helper.py --nm debug > tomyfile.txt
答案 1 :(得分:0)
我能够使用以下命令将<?xml version="1.0" encoding="UTF-8"?>
<Message>
<VersNbr>2</VersNbr>
<SubmrId>Xyz</SubmrId>
<MsgSeqNbr>000460</MsgSeqNbr>
<CreateDt>20180528</CreateDt>
<CreateTm>172428</CreateTm>
<RefBatch>
<BtchSeqNbr>00000001</BtchSeqNbr>
<ProviderNm> Travel</ProviderNm>
<TrvlBtchCurrCd>GBP</TrvlBtchCurrCd>
</RefBatch>
</Message>
的输出记录到文件中:
@XmlRootElement(name = "Message")
public class Message {
@XmlElement(name = "VersNbr")
protected int versNbr;
@XmlElement(name = "SubmrId")
protected String submrId;
@XmlElement(name = "MktCode")
protected String mktCode;
@XmlElement(name = "FileStatus")
protected String fileStatus;
@XmlElement(name = "MsgSeqNbr")
protected String msgSeqNbr;
@XmlElement(name = "CreateDt")
protected String createDt;
@XmlElement(name = "CreateTm")
protected String createTm;
@XmlElement(name = "ExprDt")
protected String exprDt;
@XmlElement(name = "HubTimeStamp")
protected String hubTimeStamp;
protected List<TravelBatch> travelBatch;
@XmlElement(name = "SettleBatch")
protected List<SettleBatch> settleBatch;
@XmlElement(name = "MessageTrailer", required = true)
protected MessageTrailer messageTrailer;
protected String isValidRec;
//getters and setters