Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a line break / blank line after my LOG statement?

People also ask

How do I add a new line in log?

Simply add \n at the end of the string to log.

How do you add an end line?

Press ALT+ENTER to insert the line break.

How do you go to a new line in Java?

In Windows, a new line is denoted using “\r\n”, sometimes called a Carriage Return and Line Feed, or CRLF. Adding a new line in Java is as simple as including “\n” , “\r”, or “\r\n” at the end of our string.

How do you break a line in JavaScript?

The newline character is \n in JavaScript and many other languages. All you need to do is add \n character whenever you require a line break to add a new line to a string.


Simply add \n at the end of the string to log.

LOGGER.info("Person's name is  {} .\n", person.getName());

If you are in a windows environment use \r\n


To get the right value of new line if you don't know the end operating system of your application you can use the property line.separator

String lineSeparator = System.getProperty("line.separator");
LOGGER.info("Person's name is  {} .{}", person.getName(), lineSeparator);

dont use \n character, but ask the System what is the newline propery. could be different in linuxor windows or..

so use

System.lineSeparator();

or before java 7 use

System.getProperty("line.separator");