• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.util.logging.Logger  RSS feed

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers!!

I made a program with a logger class.
This works fine but in the log you see the classpath on the start of every logged message. Thats not user friendly so I want to get rid of it.
It now looks like this:

9-mrt-2006 11:07:19 nl.mycompany.myprogram.somepackage.utilities.SomeLogger logProcessMessage
LOGGEDMESSAGEHERE #1
9-mrt-2006 11:07:20 nl.mycompany.myprogram.somepackage.utilities.SomeLogger logProcessMessage
LOGGEDMESSAGEHERE #2
9-mrt-2006 11:07:21 nl.mycompany.myprogram.somepackage.utilities.SomeLogger logProcessMessage
LOGGEDMESSAGEHERE #3
9-mrt-2006 11:07:22 nl.mycompany.myprogram.somepackage.utilities.SomeLogger logProcessMessage
LOGGEDMESSAGEHERE #4
9-mrt-2006 11:07:23 nl.mycompany.myprogram.somepackage.utilities.SomeLogger logProcessMessage
LOGGEDMESSAGEHERE #5

I want it to be like:
LOGGEDMESSAGEHERE #1
LOGGEDMESSAGEHERE #2
LOGGEDMESSAGEHERE #3
LOGGEDMESSAGEHERE #4
LOGGEDMESSAGEHERE #5

Does anybody know how I can do this?
I did not found any method that could change this..

Btw I log in Java with: logger.log(Level.INFO, msg);

I hope somebody knows..

Regards Jorg
[ March 16, 2006: Message edited by: Jorg Klein ]
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

you can create a custom Formatter and set it as the Formatter for your Handler.

Kai
 
Jorg Klein
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that but it did not work exactly like I wanted it to.

Would it be possible to just disable that first line:
9-mrt-2006 11:07:19 nl.mycompany.myprogram.somepackage.utilities.SomeLogger logProcessMessage

So can I just leave that one out somehow?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using Log4j from Apache project,

Its very very flexible and quiet easy to use.

The best part.. its OPEN SOURCE and also works excellently in Production enviroment too..!!
 
Jorg Klein
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srivatsan santhanam:
How about using Log4j from Apache project,

Its very very flexible and quiet easy to use.

The best part.. its OPEN SOURCE and also works excellently in Production enviroment too..!!


I know Log4j works fine, I used it before.
But I kinda build this logger from scratch and it working fine now..
The only point is that message.. There must be a way to get rid of it..

I hope somebody has an example or something!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!