문제

Output of tail logs/development.log in XFCE Terminal:

output of tail logs/development.log in XFCE Terminal

multitail log/development.log

output of multitail log/development.log

Rails adds escape codes to log files automatically. See development.log file:

  ^[[1m^[[36m (84.1ms)^[[0m  ^[[1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) ^[[0m
  ^[[1m^[[35m (92.6ms)^[[0m  CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
  ^[[1m^[[36m (0.2ms)^[[0m  ^[[1mSELECT version FROM "schema_migrations"^[[0m
  ^[[1m^[[35m (159.3ms)^[[0m  INSERT INTO "schema_migrations" (version) VALUES ('20130327221553')
  ^[[1m^[[36m (59.9ms)^[[0m  ^[[1mINSERT INTO "schema_migrations" (version) VALUES ('20130326152730')^[[0m
  ^[[1m^[[35m (59.8ms)^[[0m  INSERT INTO "schema_migrations" (version) VALUES ('20130327173637')

multitail -c produce non-usable output.

Output of multitail -c

How to colorize logs in Multitail without writing own color scheme?

도움이 되었습니까?

해결책

It's all about interpreting ANSI escape sequences which does terminal not tail itself and have to do multitail as well. It can be done with -cT ANSI option:

-cT term    interpret terminal-codes from file/command (for terminal type 'term')

Example:

$ multitail -cT ansi log/development.log
multiple files:
$ multitail -cT ansi log/development.log -cT ANSI log/test.log

colorized output of multitail -cT ansi log/development.log

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top