This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to set text format in log file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to set text format in log file" Watch "How to set text format in log file" New topic
Author

How to set text format in log file

David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
Hi, There:
I'm using java.util.logging api. How can I define my own text format (instead of using SimpleFormatter) in log file? Does anyone have some sample codes for that please?
Thanks in advance
David
David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
here is an option to extend SimpleFormatter like:
class MyFormatter extends SimpleFormatter{
public String format(LogRecord record){
return (record.getMessage()+"\r\n");
}
}
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9033
    
  10
See the java.text.MessageFormat class. It was written for this purpose.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to set text format in log file
 
Similar Threads
Text file xls to Binary format xls in Java.
how can i resultset data to text file in a table format
Bad Java Rule Round-up question (#235)
how to get the last modified time of a text file
directory creation thru java program