A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Android Security Essentials Live Lessons
this week in the
How to make each log entry start on a new line?
Joined: Jan 17, 2008
Feb 03, 2008 19:51:00
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?
boolean append = true; FileHandler filehandler = new FileHandler(errorFile,append); Logger logger = Logger.getLogger("Logging"); logger.addHandler(filehandler); logger.log(Level.INFO,"Unable to zip file:");
Joined: Jul 23, 2007
Feb 03, 2008 20:47:00
Try to append the following at the end of line:
Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%),
The Jovial Java
Joined: Oct 27, 2005
Feb 04, 2008 03:02:00
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
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: How to make each log entry start on a new line?
Writing logs to a single file from Multiple Classes
Logging in servlet
How to handle log rotation? (/var/adm/messages)
Using Multiple Loggers for SimpleFormatting AND XML
how to append and limit the size of log file using java.util.logging
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014