uTools-Manuals/docs/linux/logger.html
2019-04-21 11:50:48 +08:00

25 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="logger">logger</h1>
<p>在系统日志中记录相应条目</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>logger命令</strong> 是用于往系统中写入日志他提供一个shell命令接口到syslog系统模块</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">logger [options] [message]</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash"> -T, --tcp 使用流连接(TCP)
-d, --udp 使用数据报(UDP)
-i, --id 逐行记录每一次logger的进程ID
-f, --file &lt;file&gt; 记录特定的文件
-h, --help 显示帮助文本并退出
-n, --server &lt;name&gt; 写入指定的远程syslog服务器使用UDP代替内装式syslog的例程
-P, --port &lt;port&gt; 使用指定的UDP端口。默认的端口号是514
-p, --priority &lt;prio&gt; 指定输入消息的优先级,优先级可以是数字或者指定为 &quot; facility.level&quot; 的格式。
比如:&quot; -p local3.info &quot; local3 这个设备的消息级别为 info。
默认级别是 &quot;user.notice&quot;
-s, --stderr 输出标准错误到系统日志。
-t, --tag &lt;tag&gt; 指定标记记录
-u, --socket &lt;socket&gt; 写入指定的socket而不是到内置系统日志例程。
-V, --version 输出版本信息并退出</code></pre>
<h3 id="例子">例子</h3>
<pre><code class="language-bash">logger -p syslog.info &quot;backup.sh is starting&quot;</code></pre>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->