本文整理了Java中java.util.logging.Logger.logp()
方法的一些代码示例,展示了Logger.logp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.logp()
方法的具体详情如下:
包路径:java.util.logging.Logger
类名称:Logger
方法名:logp
[英]Log a message, specifying source class and method, with no arguments.
If the logger is currently enabled for the given message level then the given message is forwarded to all the registered output Handler objects.
[中]记录消息,指定源类和方法,不带参数。
如果记录器当前已针对给定消息级别启用,则给定消息将转发到所有已注册的输出处理程序对象。
代码示例来源:origin: MorphiaOrg/morphia
protected void log(final Level l, final String m, final Throwable t) {
if (logger.isLoggable(l)) {
logger.logp(l, className, null, m, t);
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void log(final Level level, final String message) {
if (!this.logger.isLoggable(level)) {
return;
}
logger.logp(level, componentClassName, getCallerMethodName(), message);
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void log(final Level level, final String message, Object param1) {
if (!this.logger.isLoggable(level)) {
return;
}
logger.logp(level, componentClassName, getCallerMethodName(), message, param1);
}
代码示例来源:origin: MorphiaOrg/morphia
protected void log(final Level l, final String f, final Object... a) {
if (logger.isLoggable(l)) {
logger.logp(l, className, null, f, a);
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void log(final Level level, final String message, Object[] params) {
if (!this.logger.isLoggable(level)) {
return;
}
logger.logp(level, componentClassName, getCallerMethodName(), message, params);
}
代码示例来源:origin: commons-logging/commons-logging
protected void log( Level level, String msg, Throwable ex ) {
Logger logger = getLogger();
if (logger.isLoggable(level)) {
// Hack (?) to get the stack trace.
Throwable dummyException = new Throwable();
StackTraceElement locations[] = dummyException.getStackTrace();
// LOGGING-132: use the provided logger name instead of the class name
String cname = name;
String method = "unknown";
// Caller will be the third element
if( locations != null && locations.length > 2 ) {
StackTraceElement caller = locations[2];
method = caller.getMethodName();
}
if( ex == null ) {
logger.logp( level, cname, method, msg );
} else {
logger.logp( level, cname, method, msg, ex );
}
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void finest(final String message, Object[] params) {
if (!this.logger.isLoggable(Level.FINEST)) {
return;
}
logger.logp(Level.FINEST, componentClassName, getCallerMethodName(), message, params);
}
代码示例来源:origin: MorphiaOrg/morphia
protected void log(final Level l, final String m, final Throwable t) {
if (logger.isLoggable(l)) {
final String[] callerInfo = getCaller();
logger.logp(l, callerInfo[0], callerInfo[1], m, t);
}
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void finest(final String message, final Throwable thrown) {
if (!this.logger.isLoggable(Level.FINEST)) {
return;
}
logger.logp(Level.FINEST, componentClassName, getCallerMethodName(), message, thrown);
}
代码示例来源:origin: MorphiaOrg/morphia
protected void log(final Level l, final String f, final Object... a) {
if (logger.isLoggable(l)) {
final String[] callerInfo = getCaller();
logger.logp(l, callerInfo[0], callerInfo[1], f, a);
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void fine(final String message) {
if (!this.logger.isLoggable(Level.FINE)) {
return;
}
logger.logp(Level.FINE, componentClassName, getCallerMethodName(), message);
}
代码示例来源:origin: robovm/robovm
private void log( Level level, String msg, Throwable ex ) {
Logger logger = getLogger();
if (logger.isLoggable(level)) {
// Hack (?) to get the stack trace.
Throwable dummyException=new Throwable();
StackTraceElement locations[]=dummyException.getStackTrace();
// Caller will be the third element
String cname="unknown";
String method="unknown";
if( locations!=null && locations.length >2 ) {
StackTraceElement caller=locations[2];
cname=caller.getClassName();
method=caller.getMethodName();
}
if( ex==null ) {
logger.logp( level, cname, method, msg );
} else {
logger.logp( level, cname, method, msg, ex );
}
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void config(final String message, Object[] params) {
if (!this.logger.isLoggable(Level.CONFIG)) {
return;
}
logger.logp(Level.CONFIG, componentClassName, getCallerMethodName(), message, params);
}
代码示例来源:origin: org.codehaus.groovy/groovy
public static void logMethodCall(Object object, String methodName, Object[] arguments) {
String className = getClassName(object);
String logname = "methodCalls." + className + "." + methodName;
Logger objLog = Logger.getLogger(logname);
if (!objLog.isLoggable(Level.FINER)) return;
StringBuilder msg = new StringBuilder(methodName);
msg.append("(");
if (arguments != null) {
for (int i = 0; i < arguments.length;) {
msg.append(normalizedValue(arguments[i]));
if (++i < arguments.length) {
msg.append(",");
}
}
}
msg.append(")");
objLog.logp(Level.FINER, className, msg.toString(), "called from MetaClass.invokeMethod");
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void warning(final String message, Object[] params) {
if (!this.logger.isLoggable(Level.WARNING)) {
return;
}
logger.logp(Level.WARNING, componentClassName, getCallerMethodName(), message, params);
}
代码示例来源:origin: MorphiaOrg/morphia
@Override
protected void log(final Level l, final String f, final Object... a) {
if (getLogger().isLoggable(l)) {
getLogger().logp(l, getClassName(), getCallingMethod(), f, a);
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void warning(final String message, final Throwable thrown) {
if (!this.logger.isLoggable(Level.WARNING)) {
return;
}
logger.logp(Level.WARNING, componentClassName, getCallerMethodName(), message, thrown);
}
代码示例来源:origin: MorphiaOrg/morphia
@Override
protected void log(final Level l, final String m, final Throwable t) {
if (getLogger().isLoggable(l)) {
getLogger().logp(l, getClassName(), getCallingMethod(), m, t);
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-core
public void severe(final String message, final Throwable thrown) {
if (!this.logger.isLoggable(Level.SEVERE)) {
return;
}
logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), message, thrown);
}
代码示例来源:origin: camunda/camunda-bpm-platform
private void log(Level level, String msg, Throwable ex) {
if (logger.isLoggable(level)) {
// Hack (?) to get the stack trace.
Throwable dummyException=new Throwable();
StackTraceElement locations[]=dummyException.getStackTrace();
// Caller will be the third element
String cname = "unknown";
String method = "unknown";
if (locations != null && locations.length >2) {
StackTraceElement caller = locations[2];
cname = caller.getClassName();
method = caller.getMethodName();
}
if (ex==null) {
logger.logp(level, cname, method, msg);
} else {
logger.logp(level, cname, method, msg, ex);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!