4.3. 显示属性值
您可以使用 read-attribute
操作来查看单个属性的当前值。
:read-attribute(name=ATTRIBUTE_NAME)
以下示例通过读取 level
属性来显示根日志记录器的日志级别:
/subsystem=logging/root-logger=ROOT:read-attribute(name=level) { "outcome" => "success", "result" => "INFO" }
使用 read-attribute
操作的一个优点是能够公开属性的当前运行时值。
/interface=public:read-attribute(name=resolved-address) { "outcome" => "success", "result" => "127.0.0.1" }
resolve -address
属性是 runtime 属性。在公共接口上使用 read-resource
操作时不会显示此属性,除非您通过了 include-runtime
参数。即使这样,它也会显示在资源的其余属性中。
您还可以使用 include-defaults 和 resolve
-expressions
参数。有关这些参数的详情,请参阅显示资源值。