Java Code Examples for java.util.logging.Logger.logp()

The following are Jave code examples for showing how to use logp() of the java.util.logging.Logger class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: jdk8u-jdk   File: TestIsLoggable.java   Source Code and License Vote up 6 votes
public void log(Level level, Logger logger, String message) {
    if (this.toString().startsWith("LOG_")) {
        logger.log(level, message);
    } else if (this.toString().startsWith("LOG1_")) {
        logger.log(level, message, "dummy param");
    } else if (this.toString().startsWith("LOG2_")) {
        logger.log(level, message, new Object[] {"dummy", "param"});
    } else if (this.toString().startsWith("LOG3_")) {
        logger.log(level, message, new Exception("dummy exception"));
    } else if (this.toString().startsWith("LOGP_")) {
        logger.logp(level, "TestCase", "log", message);
    } else if (this.toString().startsWith("LOGP1_")) {
        logger.logp(level, "TestCase", "log", message, "dummy param");
    } else if (this.toString().startsWith("LOGP2_")) {
        logger.logp(level, "TestCase", "log", message,
                new Object[] {"dummy", "param"});
    } else if (this.toString().startsWith("LOGP3_")) {
        logger.logp(level, "TestCase", "log", message,
                new Exception("dummy exception"));
    } else if (this.toString().startsWith("LEV_")) {
        loglevel(level, logger, message);
    }
}
 
Example 2
Project: OpenJSharp   File: ToolProvider.java   Source Code and License Vote up 5 votes
static <T> T trace(Level level, Object reason) {
    // NOTE: do not make this method private as it affects stack traces
    try {
        if (System.getProperty(propertyName) != null) {
            StackTraceElement[] st = Thread.currentThread().getStackTrace();
            String method = "???";
            String cls = ToolProvider.class.getName();
            if (st.length > 2) {
                StackTraceElement frame = st[2];
                method = String.format((Locale)null, "%s(%s:%s)",
                                       frame.getMethodName(),
                                       frame.getFileName(),
                                       frame.getLineNumber());
                cls = frame.getClassName();
            }
            Logger logger = Logger.getLogger(loggerName);
            if (reason instanceof Throwable) {
                logger.logp(level, cls, method,
                            reason.getClass().getName(), (Throwable)reason);
            } else {
                logger.logp(level, cls, method, String.valueOf(reason));
            }
        }
    } catch (SecurityException ex) {
        System.err.format((Locale)null, "%s: %s; %s%n",
                          ToolProvider.class.getName(),
                          reason,
                          ex.getLocalizedMessage());
    }
    return null;
}
 
Example 3
Project: openjdk-jdk10   File: TestLogger.java   Source Code and License Vote up 5 votes
public void error(String func, String msg) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.SEVERE,className,
                    func,msg);
}
 
Example 4
Project: openjdk-jdk10   File: TestLogger.java   Source Code and License Vote up 5 votes
public void debug(String func, String msg) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINEST,className,
                    func,msg);
}
 
Example 5
Project: jdk8u-jdk   File: MibLogger.java   Source Code and License Vote up 5 votes
public void info(String func, String msg) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.INFO,className,
                    func,msg);
}
 
Example 6
Project: jdk8u-jdk   File: TestLogger.java   Source Code and License Vote up 5 votes
public void trace(String func, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINE,className,
                    func,t.toString(),t);
}
 
Example 7
Project: jdk8u-jdk   File: TestLogger.java   Source Code and License Vote up 4 votes
public void trace(String func, String msg, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINE,className,
                    func,msg,t);
}
 
Example 8
Project: OpenJSharp   File: MibLogger.java   Source Code and License Vote up 4 votes
public void config(String func, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.CONFIG,className,
                    func,t.toString(),t);
}
 
Example 9
Project: jdk8u-jdk   File: MibLogger.java   Source Code and License Vote up 4 votes
public void warning(String func, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.WARNING,className,
                    func,t.toString(),t);
}
 
Example 10
Project: OpenJSharp   File: MibLogger.java   Source Code and License Vote up 4 votes
public void info(String func, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.INFO,className,
                    func,t.toString(),t);
}
 
Example 11
Project: jdk8u-jdk   File: MibLogger.java   Source Code and License Vote up 4 votes
public void debug(String func, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINEST,className,
                    func,t.toString(),t);
}
 
Example 12
Project: OpenJSharp   File: MibLogger.java   Source Code and License Vote up 4 votes
public void warning(String func, String msg) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.WARNING,className,
                    func,msg);
}
 
Example 13
Project: openjdk-jdk10   File: TestLogger.java   Source Code and License Vote up 4 votes
public void trace(String func, String msg) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINE,className,
                    func,msg);
}
 
Example 14
Project: OpenJSharp   File: MibLogger.java   Source Code and License Vote up 4 votes
public void warning(String func, String msg, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.WARNING,className,
                    func,msg,t);
}
 
Example 15
Project: OpenJSharp   File: MibLogger.java   Source Code and License Vote up 4 votes
public void trace(String func, String msg) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINE,className,
                    func,msg);
}
 
Example 16
Project: OpenJSharp   File: MibLogger.java   Source Code and License Vote up 4 votes
public void trace(String func, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINE,className,
                    func,t.toString(),t);
}
 
Example 17
Project: jdk8u-jdk   File: TestLogger.java   Source Code and License Vote up 4 votes
public void debug(String func, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINEST,className,
                    func,t.toString(),t);
}
 
Example 18
Project: jdk8u-jdk   File: TestLogger.java   Source Code and License Vote up 4 votes
public void trace(String func, String msg) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINE,className,
                    func,msg);
}
 
Example 19
Project: OpenJSharp   File: MibLogger.java   Source Code and License Vote up 4 votes
public void debug(String func, String msg, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINEST,className,
                    func,msg,t);
}
 
Example 20
Project: jdk8u-jdk   File: TestLogger.java   Source Code and License Vote up 4 votes
public void debug(String func, String msg, Throwable t) {
    final Logger l = getLogger();
    if (l!=null) l.logp(Level.FINEST,className,
                    func,msg,t);
}