Solved Remove color codes from console/log

Discussion in 'Bukkit Help' started by daboross, Sep 21, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    daboross

    I have a completely messed up color scheme in my Bukkit server console, and I would like to know how (if there is a way) to wipe all text going to the console clean of color codes. I would also like to remove them from the server.log as they look very weird in it.

    I'm not sure if I need any more details, if you want this is my start up log: http://pastebin.com/skm58bg1

    It is mostly essentials chat that is making the color codes, but I can't find an option in there to disable them to console.

    EDIT: I guess I should call this thread "Remove colors in console". but never mind.
     
  2. Offline

    JWhy

    You could give adding --nojline to the startup command a try
     
  3. Offline

    daboross

    Having the startup script be: java -d64 -Xms1024m -Xmx2048m -jar CraftBukkit.jar nogui nojline ?
    or java -d64 -Xms1024m -Xmx2048m -jar CraftBukkit.jar nogui --nojline ?

    AWESOME, Thanks! using --nojline worked!

    But it also removed the > before where I put a command? Is this bad?
     
  4. Offline

    Lolmewn

    Naah.
     
  5. Offline

    JWhy

  6. Offline

    daboross

  7. Offline

    JWhy

    The most important part of it was
    ;)
     
  8. Offline

    Sushi

    That isn't for ubuntu server...
     
  9. Offline

    daboross

    It doesn't really matter :p. The --nojline worked :p.
     
  10. Offline

    JWhy

     
  11. Offline

    daboross

    Ok, this is no longer solved, I am having strange errors when i use that option.

    For instance if I am typing a command, and then someone says something, what I had typed shows behind what they said, but then if I continue typing and then press enter, the full command runs...

    Here is an example:
    Code:
    2012-09-22 16:37:31 [INFO] Survivor[Dizian] wait
    2012-09-22 16:37:34 [INFO] Survivor[Dizian] stop
    2012-09-22 16:37:36 [INFO] Survivor[Overkill_Dude] I found a flaw
    2012-09-22 16:37:37 [INFO] Survivor[Overkill_Dude] :p
    say this is an 2012-09-22 16:37:44 [INFO] Survivor[Enderman] hi zenn! :D
    example 2012-09-22 16:37:47 [INFO] Survivor[ZennPanda] HAPPY BIRTHDAY!
    text
    2012-09-22 16:37:48 [INFO] [Server] this is an example text
    2012-09-22 16:37:49 [INFO] Survivor[Dizian] lol cheater
    I just typed "say this is an example text" and pressed enter while people were chatting, and that happened...

    I'm assuming that jline was preventing this from happening before, because this only happens when i use the "--nojline" option.

    Is there a way to remove colors without having this happen?
     
  12. Offline

    Sushi

  13. Offline

    daboross

    D: Really?

    Is there possibly a way to make a plugin that intercepts messages that go to console and log, and remove the colors?
     
  14. Offline

    Sushi

  15. Offline

    daboross

    Ok, I haven't solved the weird console output, but I wrote a script in ubuntu to remove all those nasty characters in the log! This is a script that archives the log to a server-YEAR-MONTH-DAY.log and server-YEAR-MONTH-DAY-nocolor.log as well as removing all the nasty color codes from the nocolor log archive:
    Code:
    echo $(date +%Y/%m/%d) $(date +%H:%M) Archiving Server Log to $(date +server-%Y-%m-%d).log and sending nocolor to $(date +server-%Y-%m-%d-nocolor).log>> /home/newlanders/logs/$(date +commands-%Y-%m-%d).log
    cp /home/newlanders/server/server.log /home/newlanders/server/$(date +server-%Y-%m-%d).log
    cp /home/newlanders/server/server.log /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[37;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[34;22m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[32;22m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[36;22m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[31;22m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[35;22m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[33;22m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[37;22m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[30;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[30;22m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[32;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[36;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[31;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[35;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[33;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[37;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[0;39m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[34;1m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's/\[m//g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log
    sed -i 's///g' /home/newlanders/server/$(date +server-%Y-%m-%d-nocolor).log

    I am just posting that here, in case anyone else finds it helpful!

    Replace /home/newlanders/server with your server directory.

    Edit:

    I am now using --log-strip-color. It works.
    I am also no longer watching this thread. Tagh me if you reply.
     
    Europia79 and Drift_91 like this.
  16. Offline

    Drift_91

    Oh thank god. You just pulled a huge thorn out of my side.

    It's bad enough being a slow reader. Having the codes in the log makes it 5 times worse when I have to read over drama that occurs while I'm offline.
     
  17. Offline

    daboross

    You're welcome, glad it helped someone!
     
    Drift_91 likes this.
  18. Offline

    Europia79

    daboross
    i'll definitely have to try this... I'm curious tho, which part of the Java startup command are you putting "--log-strip-color" ? At the very end ? (with or without the double-dash ?)
    EDIT: cool script too... imma have to make a cron job with $(date +%m%d) backups. nice1
     
  19. Offline

    daboross

    Just using --log-strip-color at the very end of the start script with the -- will make it strip colors from the log automatically, ye.
     
  20. Offline

    LHammonds

    Bummer, this didn't work for me.

    Using CraftBukkit 1.7.2-R0.1 (Build 2936), Java 1.7.0_45 (64-bit) on Ubuntu Server 12.04.3 LTS (64-bit)

    Startup command:
    Code:
    java -d64 -Xincgc -Xmx6144M -jar /path/to/craftbukkit.jar nogui --log-strip-color
    I still see color codes added to the "latest.log" file such as:
    Code:
    [14:52:36] [Server thread/INFO]: ^[[0;33;22m[Auction] ^[[0;32;1m^[[0;37;1mhas been enabled.^[[m
    [14:52:43] [Thread-17/INFO]: [SignEdit] §5SignEdit is up to date
    
     
  21. Offline

    daboross

    Try removing the nogui, it doesn't do anything in CB, not sure if it would be interfering but it may.
     
  22. Offline

    LHammonds

    Made no difference with "nogui" removed from the command line. The "nogui" doesn't actually do anything on an Ubuntu Server but it does prevent the java window from showing up on a Windows machine.
     
  23. Offline

    daboross

    Ah, I thought bukkit had removed the java window / gui completely from the minecraft server. Anyways, I wouldn't be sure why it wouldn't be working otherwise, probably making a thread specifically about that issue might help as this one is a bit old. It is documented to work at http://wiki.bukkit.org/CraftBukkit_Command_Line_Arguments.
     
  24. Offline

    Tanite

    I also tried --log-strip-color on 1.7.2 builds and it doesn't seem to be working. It sounds like it used to work for people so maybe it's a current bug or something they didn't get to yet.
     
Thread Status:
Not open for further replies.

Share This Page