# logger

在系统日志中记录相应条目

## 补充说明

**logger命令** 是用于往系统中写入日志，他提供一个shell命令接口到syslog系统模块

### 语法

```
logger [options] [message]
```

### 选项

```
 -T, --tcp             使用流连接(TCP)
 -d, --udp             使用数据报(UDP)
 -i, --id              逐行记录每一次logger的进程ID
 -f, --file <file>     记录特定的文件
 -h, --help            显示帮助文本并退出
 -n, --server <name>   写入指定的远程syslog服务器，使用UDP代替内装式syslog的例程
 -P, --port <port>     使用指定的UDP端口。默认的端口号是514
 -p, --priority <prio> 指定输入消息的优先级，优先级可以是数字或者指定为 " facility.level" 的格式。
                       比如：" -p local3.info " local3 这个设备的消息级别为 info。
                       默认级别是 "user.notice"
 -s, --stderr          输出标准错误到系统日志。
 -t, --tag <tag>       指定标记记录
 -u, --socket <socket> 写入指定的socket，而不是到内置系统日志例程。
 -V, --version         输出版本信息并退出
```

### 例子

```
logger -p syslog.info "backup.sh is starting"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hezhiqiang.gitbook.io/linux/ming-ling/logger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
