Ton*_*ony 3 java linux ubuntu logging sys
跟进此问题,LogBack Syslog无法正常工作
我使用下面的命令syslog在ubuntu16.04中查看,但得到以下结果。这是正确的观看方式吗?
user@xxx:~$ tail -f /var/log/syslog Jun 6 23:08:50 xxx systemd[1]:
Starting Hostname Service... Jun 6 23:08:50 xxx dbus[889]: [system]
Successfully activated service 'org.freedesktop.hostname1' Jun 6
23:08:50 xxx systemd[1]: Started Hostname Service. Jun 6 23:09:41 xxx
gnome-session[2645]: (nautilus:2860): Gtk-WARNING **: Attempting to
read the recently used resources file at
'/home/xxx/.local/share/recently-used.xbel', but the parser failed:
Failed to open file '/home/xxx/.local/share/recently-used.xbel':
Permission denied. Jun 6 23:09:41 xxx org.gtk.vfs.Daemon[2508]:
(gvfsd-recent:15282): Gtk-WARNING **: Attempting to read the recently
used resources file at '/home/xxx/.local/share/recently-used.xbel',
but the parser failed: Failed to open file
'/home/xxx/.local/share/recently-used.xbel': Permission denied. Jun 6
23:09:41 xxx gnome-session[2645]: (zeitgeist-datahub:3069):
Gtk-WARNING **: Attempting to read the recently used resources file at
'/home/xxx/.local/share/recently-used.xbel', but the parser failed:
Failed to open file '/home/seng/.local/share/recently-used.xbel':
Permission denied. Jun 6 23:09:49 xxx gnome-session[2645]:
(nautilus:2860): Gtk-WARNING **: Attempting to read the recently used
resources file at '/home/xxx/.local/share/recently-used.xbel', but the
parser failed: Failed to open file
'/home/xxx/.local/share/recently-used.xbel': Permission denied. Jun 6
23:09:49 xxx org.gtk.vfs.Daemon[2508]: (gvfsd-recent:15282):
Gtk-WARNING **: Attempting to read the recently used resources file at
'/home/xxx/.local/share/recently-used.xbel', but the parser failed:
Failed to open file '/home/xxx/.local/share/recently-used.xbel':
Permission denied. Jun 6 23:09:49 xxx gnome-session[2645]:
(zeitgeist-datahub:3069): Gtk-WARNING **: Attempting to read the
recently used resources file at
'/home/seng/.local/share/recently-used.xbel', but the parser failed:
Failed to open file '/home/xxx/.local/share/recently-used.xbel':
Permission denied. Jun 6 23:17:01 xxx CRON[18877]: (root) CMD ( cd
/ && run-parts --report /etc/cron.hourly)
Run Code Online (Sandbox Code Playgroud)
试试cat /var/log/syslog(输出的一小部分)
Jun 6 23:37:26 xxx whoopsie[1040]: [23:37:26] online
Jun 6 23:37:26 xxx avahi-daemon[1023]: Registering new address record for 2001:e68:4424:afab:c31f:c843:2351:c58 on wlp6s0.*.
Jun 6 23:37:28 xxx dhclient[19397]: XMT: Solicit on wlp6s0, interval 4340ms.
Jun 6 23:37:32 xxx dhclient[19397]: XMT: Solicit on wlp6s0, interval 9080ms.
Jun 6 23:37:41 xxx dhclient[19397]: XMT: Solicit on wlp6s0, interval 17540ms.
Jun 6 23:37:59 xxx dhclient[19397]: XMT: Solicit on wlp6s0, interval 34190ms.
Jun 6 23:38:09 xxx NetworkManager[1013]: <warn> [1496763489.9447] dhcp6 (wlp6s0): request timed out
Jun 6 23:38:09 xxx NetworkManager[1013]: <info> [1496763489.9448] dhcp6 (wlp6s0): state changed unknown -> timeout
Jun 6 23:38:09 xxx NetworkManager[1013]: <info> [1496763489.9456] dhcp6 (wlp6s0): canceled DHCP transaction, DHCP client pid 19397
Jun 6 23:38:09 xxx NetworkManager[1013]: <info> [1496763489.9456] dhcp6 (wlp6s0): state changed timeout -> done
user@xxx:/$
Run Code Online (Sandbox Code Playgroud)
尝试 cat /var/log/syslog | tail -f
user@xxx:/$ cat /var/log/syslog | tail -f
Jun 6 23:37:26 xxx whoopsie[1040]: [23:37:26] online
Jun 6 23:37:26 xxx avahi-daemon[1023]: Registering new address record for 2001:e68:4424:afab:c31f:c843:2351:c58 on wlp6s0.*.
Jun 6 23:37:28 xxx dhclient[19397]: XMT: Solicit on wlp6s0, interval 4340ms.
Jun 6 23:37:32 xxx dhclient[19397]: XMT: Solicit on wlp6s0, interval 9080ms.
Jun 6 23:37:41 xxx dhclient[19397]: XMT: Solicit on wlp6s0, interval 17540ms.
Jun 6 23:37:59 xxx dhclient[19397]: XMT: Solicit on wlp6s0, interval 34190ms.
Jun 6 23:38:09 xxx NetworkManager[1013]: <warn> [1496763489.9447] dhcp6 (wlp6s0): request timed out
Jun 6 23:38:09 xxx NetworkManager[1013]: <info> [1496763489.9448] dhcp6 (wlp6s0): state changed unknown -> timeout
Jun 6 23:38:09 xxx NetworkManager[1013]: <info> [1496763489.9456] dhcp6 (wlp6s0): canceled DHCP transaction, DHCP client pid 19397
Jun 6 23:38:09 xxx NetworkManager[1013]: <info> [1496763489.9456] dhcp6 (wlp6s0): state changed timeout -> done
user@xxx:/$
Run Code Online (Sandbox Code Playgroud)
看起来您正在尝试syslog从Java而不是从交互式终端进行读取。文本看起来像是正确的输出,但是格式被捣毁。
tail -f 适用于交互式终端。
尝试使用cat /var/log/syslog,或者仅/var/log/syslog作为文件打开(如果您的进程具有足够的权限)。
在普通的终端窗口(在 Ubuntu 中,通常是 Gnome 终端)中,您所做的 - sudo tail /var/log/syslog应该显示换行符,以便日期/时间戳在左侧排列。
要么您没有使用普通的终端窗口,要么某些控制字符使您的终端进入无法正确显示换行符的状态。
如果您使用的不是终端窗口(也许是您的 IDE 中的某些东西?),那么请改用普通窗口。
tail -f /var/log/syslog 用于跟随文件的增长。
您可以将整个文件转储到终端中cat /var/log/syslog。
您可以使用 交互式滚动文件less /var/log/syslog。
如果您更喜欢使用 GUI 编辑器,您可以/var/log/syslog在 gEdit 或 Atom 之类的文本编辑器中打开,尽管您必须以 root 身份运行这些编辑器 - 负责的事情是复制文件,使其可读用户,然后打开它。
| 归档时间: |
|
| 查看次数: |
15690 次 |
| 最近记录: |