This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to format logging message

 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all.

I am using jdk logging utilities.
The following is my output:
=========================================
2004/12/3 pm 05:42:35 test.Nose main
Info: I love JavaRanch.com
2004/12/3 pm 05:42:36 test.Nose main
Fine: help me
=========================================
I know how to do it in log4j but I don't know how to make jdk logging not print out "test.Nose main".
Please be kind to tell me how to delete "test.Nose main" when it prints out message??
Thank you in advance.
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found a way to format the message in Informit.com myself.
Please needn't reply to this post.
Thanks.
 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you get the output of the logger on one line ?

Like:

test.main : <message>

because by default it takes two lines (like you stated) and the only way to put it all on one line was to create a custom formatter.
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Koen Serneels.

Thank you for the reply.
Like what you said, I wrote class EasyFormatter which extends Formatter to format message. I prefer Log4J personally.
When I searched JDK logging usage in internet, not many articles are about how to use it. It seems not many people use it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic