本文整理汇总了Java中java.util.logging.Logger.logp方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.logp方法的具体用法?Java Logger.logp怎么用?Java Logger.logp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.logging.Logger
的用法示例。
在下文中一共展示了Logger.logp方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: log
import java.util.logging.Logger; //导入方法依赖的package包/类
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);
}
}
示例2: trace
import java.util.logging.Logger; //导入方法依赖的package包/类
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;
}
示例3: trace
import java.util.logging.Logger; //导入方法依赖的package包/类
public void trace(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINE,className,
func,t.toString(),t);
}
示例4: error
import java.util.logging.Logger; //导入方法依赖的package包/类
public void error(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.SEVERE,className,
func,msg);
}
示例5: config
import java.util.logging.Logger; //导入方法依赖的package包/类
public void config(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.CONFIG,className,
func,t.toString(),t);
}
示例6: debug
import java.util.logging.Logger; //导入方法依赖的package包/类
public void debug(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINEST,className,
func,msg);
}
示例7: info
import java.util.logging.Logger; //导入方法依赖的package包/类
public void info(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.INFO,className,
func,msg);
}
示例8: warning
import java.util.logging.Logger; //导入方法依赖的package包/类
public void warning(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.WARNING,className,
func,t.toString(),t);
}
示例9: info
import java.util.logging.Logger; //导入方法依赖的package包/类
public void info(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.INFO,className,
func,t.toString(),t);
}
示例10: debug
import java.util.logging.Logger; //导入方法依赖的package包/类
public void debug(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINEST,className,
func,t.toString(),t);
}
示例11: warning
import java.util.logging.Logger; //导入方法依赖的package包/类
public void warning(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.WARNING,className,
func,msg);
}
示例12: trace
import java.util.logging.Logger; //导入方法依赖的package包/类
public void trace(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINE,className,
func,msg);
}
示例13: debug
import java.util.logging.Logger; //导入方法依赖的package包/类
public void debug(String func, String msg, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINEST,className,
func,msg,t);
}