aspose file tools*
The moose likes Beginning Java and the fly likes How to make each log entry start on a new line? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to make each log entry start on a new line?" Watch "How to make each log entry start on a new line?" New topic
Author

How to make each log entry start on a new line?

Ong CherYee
Greenhorn

Joined: Jan 17, 2008
Posts: 11
am doing java logging to file using the logger class. In order to write logs to the file, a file handler was created using the 'append' mode.

However, when the
log entries are written to the log file, they are all entered on a single line.

How do I make each new log entry start on a new line?

Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Try to append the following at the end of line:

"\n"

or

"\r\n"


Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19755
    
  20

Better yet, use System.getProperty("line.separator"). That will use the platform dependant line separator - \n for Unix, \r\n for Windows, etc.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make each log entry start on a new line?