Colors get messed up, i think when tailing log files

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
toastkid

Colors get messed up, i think when tailing log files

Post by toastkid »

Hi all. I've got a new laptop and have installed Mint MATE on it. (previously i used Ubuntu 10).

I have a weird issue that happens periodically. I often tail log files (with tail -f so they update dynamically) and sometimes when lots of logging is scrolling past quickly while i'm viewing it, the following happens:

- the computer totally freezes for a few seconds
- when it comes back, the colours are messed up in my terminal: it seems like all the colours have changed to a different colour. (I'm using Mate Terminal 1.1). This "messing up" doesn't happen the same way every time - it seems random. I can change the ansi colour for my terminal to yellow ("\[\033[0;33m\]") for example and it comes out looking red.
- sometimes this affects my desktop apps: for example in geany or gedit, the syntax colouring has been swapped to different colours (sometimes resulting in unreadable combinations like very dark grey on black)
- restarting the terminal and affected apps makes no difference: the only way i've found to cure it is to reboot.

I mentioned this to a colleage and he theorized that some combination of characters was coming through in the logs and being interpreted as some kind of command sequence by tail, or terminal, or something. Kind of vague and very hard to investigate.

Any ideas anyone? has anyone else encountered this?

Grateful for any advice! thanks for reading.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Fishbowler
Level 1
Level 1
Posts: 15
Joined: Fri Mar 18, 2011 6:07 am

Re: Colors get messed up, i think when tailing log files

Post by Fishbowler »

Are they system log files or logs from something else? Check to see if the log file is executable.
I had a similar problem recently using cat on some non-human-readable files. Terminal titles changing and all sorts.

Fixed the whole folder with:

Code: Select all

chmod -R a-x+X
toastkid

Re: Colors get messed up, i think when tailing log files

Post by toastkid »

Hi - thanks.
Fishbowler wrote:Are they system log files or logs from something else?
They're from a ruby on rails app.
Fishbowler wrote: Check to see if the log file is executable.
Ah, one of the files i've been tailing is executable. (just noticed that) I'll change it and see if the problem recurs. Thanks!
toastkid

Re: Colors get messed up, i think when tailing log files

Post by toastkid »

This just happened again, and the log file definitely wasn't executable. :/

Any more ideas, anyone?
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Colors get messed up, i think when tailing log files

Post by catweazel »

That can happen if the logs contain control codes. I'd be inclined to open the file in a gui text editor and scan for odd-looking characters then remove them. If that fixes the issue then your theorising friend was right.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
Locked

Return to “Other topics”