0

When I run this code, nothing is printed to the console. How should I use logp?

import java.util.logging.Level;
import java.util.logging.Logger;

public class Log {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Logger.getGlobal().logp(Level.ALL, Log.class.getName(), "main", "t");
    }
}
Andrew Lygin
  • 6,077
  • 1
  • 32
  • 37

1 Answers1

1

Your logger doesn't print the message because of too low logging level. ALL is usually used for configuring loggers, not for actual logging. Change the logging level to INFO and you'll see your message:

Logger.getGlobal().logp(Level.INFO, Log.class.getName(), "main", "t");

Also, read something on JUL. For instance, good examples and why not use JUL.

Community
  • 1
  • 1
Andrew Lygin
  • 6,077
  • 1
  • 32
  • 37