Save This Page
Home » slf4j-1.5.5 » org.apache » log4j » helpers » [javadoc | source]
org.apache.log4j.helpers
public class: SingleLineTracerPrintWriter [javadoc | source]
java.lang.Object
   TracerPrintWriter
      org.apache.log4j.helpers.SingleLineTracerPrintWriter
SingleLineTracerPrintWriter overrides the println function in TracerPrintWriter by replacing the TAB character with spaces. It also does not print the "\n".

The default format generated by TracerPrintWriter for exceptions prints on multiple lines, which does not interact well with some logging systems. On the other hand, a stack-trace on one line can be a mite difficult to read, so this class should only be used where really necessary :-)

For syslog daemons, tabs in messages are not friendly, hence the replacement of tabs by spaces here. It shouldn't do any harm to do this for all messages...

Perhaps it might be better to enhance TracerPrintWriter to have a configuration item for one-line or multi-line mode...
Field Summary
static  String TAB     
Constructor:
 public SingleLineTracerPrintWriter(QuietWriter qWriter) 
Method from org.apache.log4j.helpers.SingleLineTracerPrintWriter Summary:
println,   println
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.log4j.helpers.SingleLineTracerPrintWriter Detail:
 public  void println(Object o) 
    Make the first Exception line print properly by omitting the \n at the end.
 public  void println(String s) 
    Remove the first character from the string (usually a TAB) and do not print "\n"