OpenWrt 使用logger命令输出日志

logger "this is a test log."
logger -t test "this is a test log."
logger -t test -s "this is a test log."

对应输出:
Jun 30 15:28:59 (none) user.notice root: this is a test log.
Jun 30 15:28:59 (none) user.notice test: this is a test log.
Jun 30 15:29:00 (none) user.notice test: this is a test log.

logger -t 指定标签,默认是用户名
logger -s hello 输出到stderr和系统日志
logger -p 1 指定优先级

root@OpenWrt:~# logger --help
BusyBox v1.30.1 () multi-call binary.
Usage: logger [OPTIONS] [MESSAGE]
Write MESSAGE (or stdin) to syslog
        -s      Log to stderr as well as the system log
        -t TAG  Log using the specified tag (defaults to user name)
        -p PRIO Priority (numeric or facility.level pair)

# 查看syslogd使用的配置文件    
root@OpenWrt:~# ps | grep syslogd
 1615 root      1380 S    /sbin/syslogd -f/etc/syslog.conf

# 查看日志输出路径
root@OpenWrt:~# cat /etc/syslog.conf
*.* /var/log/syslog

# 持续查看日志文件
tail -f /var/log/syslog | grep test
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值