1

I added Java's own Logger ( java.util.logging.Logger) to my project, thinking this was a better practice than using System.out.printLn, but was disappointed to find that all the console output was in Red. I would expect this for items logged as Severe or maybe even Warn, but this even included Info items. Is there a way of modifying these colours? If not, I shall just have to return to System.out.printLn.

I am not looking to print different colours using System.out.printLn.

Steve Staple
  • 2,983
  • 9
  • 38
  • 73
  • 1
    By "console output" do you mean the output window of your IDE (whether IntelliJ, NetBeans or Eclipse)? That doesn't support colours. It simply puts stderr output in red and stdout output in black. – Klitos Kyriacou Jan 10 '18 at 11:40
  • @Klitos Kyriacou - thank you - that answers my question. – Steve Staple Jan 10 '18 at 11:45
  • 2
    You can get 2 different colors (black and red default of IDE) on IDE's console by using two different statements of println() as follows: `System.out.println("hello");` `System.err.println("hola");` as *System*'s **err** and **out** both have **println** method. – S Jayesh Jan 10 '18 at 11:51
  • 4
    @haraldK how on earth is this a duplicate? The duplicate concerns System.out while this question concerns java logging. Two very separate things. – DodgyCodeException Jan 10 '18 at 11:53
  • 1
    @SteveStaple you may be able to configure the output handlers (see e.g. https://github.com/mihnita/java-color-loggers) but then you'll have to run the application in a shell (or Command Prompt) window. – DodgyCodeException Jan 10 '18 at 11:55
  • 1
    You could toggle between red and black [by using a custom handler](https://stackoverflow.com/questions/194165/how-do-i-change-java-logging-console-output-from-std-err-to-std-out). – jmehrens Jan 11 '18 at 16:10

0 Answers0