-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
com.tuyang.beanutils.internal.logger.Logger
springboot recommends logback, but the jar must use the log4j, Otherwise, it will directly system.out.println. it does not make sense,
public static Logger getLogger(Class<?> clazz) {
try {
Class<?> loggerClass = Logger.class.getClassLoader().loadClass("org.apache.log4j.Logger");
Method method = loggerClass.getMethod("getLogger", Class.class);
Object logger = method.invoke(null, clazz);
return new Logger(logger);
}catch (Exception e) {
}
return new Logger(null);
}
public void info(Object message, Throwable t) {
if( logger != null ) {
try {
Method method = logger.getClass().getMethod("info", Object.class, Throwable.class);
method.invoke(logger, message, t);
} catch (Exception e) {
e.printStackTrace();
}
} else {
if( BeanCopyConfig.instance().getLogLevel() < LogLevelInfo )
return;
System.out.println(message.toString());
t.printStackTrace();
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels