1

I am using :

log.info("Message");

and the output is:

Jul 8, 2014 12:58:02 PM myclass main
INFO: message

How do i just print the message without the date and INFO: ?

Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
Ashley06
  • 29
  • 1
  • 2
  • 7
  • which logging framework – jmj Jul 08 '14 at 17:00
  • 2
    Sounds like you just need to configure logging appropriately. Read http://tutorials.jenkov.com/java-logging/configuration.html or another similar tutorial... If you still have problems, post what you've tried and what went wrong. – Jon Skeet Jul 08 '14 at 17:03
  • If the extra info always has the same format, you could split the string where the Message connects to the INFO and just print the Message. – Joshua Hyatt Jul 08 '14 at 17:06

1 Answers1

6

Change the format of the SimpleFormatter using the system property:

-Djava.util.logging.SimpleFormatter.format="%2$s: %5$s%6$s%n"

or in the logging.properties:

java.util.logging.SimpleFormatter.format=%2$s: %5$s%6$s%n

All of these properties are documented in the format method.

jmehrens
  • 10,580
  • 1
  • 38
  • 47