Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the length of Java log4j's log message's max length? How to print it in a single line?

Tags:

java

log4j

In log4j default logging configuration, each line of log message which is printed in server log has maximum length comes around 8221 characters. If it exceeds this length, it is printed in multiple lines. But I want to print it in a single line, though whatever the length of each log message has.

like image 392
Sakthivel Avatar asked May 10 '10 06:05

Sakthivel


People also ask

How do you do logs in Java?

The process of creating a new Logger in Java is quite simple. You have to use Logger. getLogger() method. The getLogger() method identifies the name of the Logger and takes string as a parameter.


1 Answers

To get log print in a single line, What I did is, I configured PatternLayout like value="%m%n", without configuring date format and etc..

<layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%m%n"/>
</layout>

This is what my need & get solved.

like image 193
Sakthivel Avatar answered Oct 04 '22 02:10

Sakthivel