[JAVA] How to color code console output in Eclipse

If you use System.out.println () etc. to output the log to the console, it may be difficult to find the log because it is buried when you want to check the console log.

Sample


public class Sample {
	public static void main(String[] args) {
		for (int i=0; i<10; i++) {
			if (i == 5) {
				System.out.println(i+"This is the second loop.");
			}
			if (i%3==0) {
				System.out.println("Hoge Hoge");
			} else if (i%3==1) {
				System.out.println("Huga Huga");
			} else {
				System.out.println("Moku Moku");
			}
		}
	}
}

a.PNG

In such a case, you can use ** System.err.println ** to display the item you want to check in red. In Eclipse, the standard error output seems to be output in red. (By the way, the standard input is green)

if (i == 5) {
    System.err.println(i + " times");
}

aa.PNG

Recommended Posts

How to color code console output in Eclipse
Output settings to debug console in Visual Studio Code
How to run JUnit in Eclipse
How to set Lombok in Eclipse
How to set character code and line feed code in Eclipse
[swift5] How to specify color in hexadecimal
How to include Spring Tool in Eclipse 4.6.3?
How to output Java string to console screen
[For beginners] How to debug in Eclipse
Enable log output to both file and console using log4j in Eclipse.
[JavaFX] How to write Eclipse permissions in build.gradle
(Memo) How to solve dummy output in Ubuntu 20.04
To debug in eclipse
How to automatically generate a constructor in Eclipse
How to implement UICollectionView in Swift with code only
[Ruby] How to use standard output in conditional branching
How to switch Tomcat context.xml with WTP in Eclipse
How to input / output IBM mainframe files in Java?
How to use Z3 library in Scala with Eclipse
How to display a browser preview in VS Code
How to use JDD library in Scala with Eclipse
How to Git manage Java EE projects in Eclipse
How to debug the generated jar file in Eclipse
How to write good code
How to use Eclipse Debug_Shell
Output JaCoCo coverage to console
How to specify character code and line feed code in JAXB
How to select a specified date by code in FSCalendar
[Swift5] How to avoid applying dark mode (dark appearance) in code
How to deploy Java application to Alibaba Cloud EDAS in Eclipse
How to find May'n in XPath
How to hide scrollbars in WebView
[Rails] How to write in Japanese
How to run Ant in Gradle
How to master programming in 3 months
How to learn JAVA in 7 days
How to get parameters in Spark
How to install Bootstrap in Ruby
Log output to file in Java
How to use InjectorHolder in OpenAM
How to introduce jQuery in Rails 6
How to use classes in Java?
How to name variables in Java
Switch from Eclipse to VS Code
How to write easy-to-understand code [Summary 3]
java Eclipse How to debug javaScript
[RSpec] How to write test code
How to concatenate strings in java
How to install Swiper in Rails
How to output the value when there is an array in the array
Only this! How to prevent forgetting code format in team development
How to output a list of strings in JSF as comma-separated strings
A memorandum on how to use Eclipse
How to implement search functionality in Rails
How to implement date calculation in Java
How to implement Kalman filter in Java
Multilingual Locale in Java How to use Locale
How to use Apache Derby on Eclipse
How to change app name in rails
How to get date data in Ruby
How to use custom helpers in rails