本文整理了Java中top.wboost.common.log.entity.Logger
类的一些代码示例,展示了Logger
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger
类的具体详情如下:
包路径:top.wboost.common.log.entity.Logger
类名称:Logger
[英]Logger 日志接口
[中]记录器日志接口
代码示例来源:origin: top.wboost/common-utils-web
@Override
public void setApplicationContext(ApplicationContext arg0) throws BeansException {
applicationContext = arg0;
log.info("init");
}
代码示例来源:origin: top.wboost/common-utils
public static void debug() {
StackTraceElement[] stacks = (new Throwable()).getStackTrace();
for (StackTraceElement stack : stacks) {
log.debug(stack.getClassName() + "-" + stack.getMethodName());
}
}
代码示例来源:origin: top.wboost/common-web
public static void loadMessageByPath(String path) {
log.debug("loadMessageByPath... {}", path);
Properties messageProperties = PropertiesUtil.loadProperties(path);
for (Entry<Object, Object> businessCode : messageProperties.entrySet()) {
try {
Integer code = Integer.valueOf((String) businessCode.getKey());
String message = (String) businessCode.getValue();
codeMessageMap.put(code, message == null ? "" : message);
} catch (Exception e) {
log.error("key : {},value: {} ,error is : {}", businessCode.getKey(), businessCode.getValue(),
e.getLocalizedMessage());
}
}
log.debug("loadMessageByPath end...");
}
代码示例来源:origin: top.wboost/common-web
public HttpRequestBuilder addParameter(final String name, final String value, Boolean canEmpty) {
if ((!canEmpty) && (!StringUtil.notEmpty(value))) {
if (log.isDebugEnabled()) {
log.debug("{} cant empty and value is empty. ignore", name);
return this;
}
}
return addParameter(new BasicNameValuePair(name, value));
}
代码示例来源:origin: top.wboost/common-web
@Override
public boolean checkParameter(Annotation parameterConfig, Object arg) {
if (parameterConfig.annotationType().isAnnotationPresent(ParameterConfig.class)) {
ParameterConfigChecker checker = parameterConfigMap.get(parameterConfig.annotationType());
if (checker == null) {
throw new BusinessException();
}
return checker.check(arg, parameterConfig, "");
}
if (log.isWarnEnabled()) {
log.warn("Annotation {} is not a parameterConfig annotation", parameterConfig);
}
return false;
}
代码示例来源:origin: top.wboost/common-web
public void afterPropertiesSet() throws Exception {
log.info("properties config check init...");
if (notNullMap != null) {
for (Map.Entry<String, String> nutNullEntry : notNullMap.entrySet()) {
propertiesVal = PropertiesUtil.getProperty(nutNullEntry.getKey(), nutNullEntry.getValue());
log.debug("find notNullMap properties : {} in {} , value is {}.", nutNullEntry.getKey(),
nutNullEntry.getValue(), propertiesVal);
if (StringUtil.notEmpty(propertiesVal)) {
propertiesVal = PropertiesUtil.getProperty(canNullEntry.getKey(), canNullEntry.getValue());
log.debug("find canNullMap properties : {} in {} , value is {}.", canNullEntry.getKey(),
canNullEntry.getValue(), propertiesVal);
if (propertiesVal == null) {
log.info("all properties check success");
代码示例来源:origin: top.wboost/common-kylin
private Callback checkResult(ResponseEntity<String> responseBody) {
if (responseBody.getStatusCode() != HttpStatus.OK) {
if (responseBody.getStatusCode() == HttpStatus.UNAUTHORIZED) {
if (!checkAuthentication()) {
log.info("kylin UNAUTHORIZED ,now doAuthentication");
if (doAuthentication()) {
log.info("restart executeQuery");
return Callback.RESTART;
}
} else {
log.error("UNAUTHORIZED");
throw new KylinAuthenticationException(String.valueOf(responseBody.getStatusCodeValue()));
}
} else if (responseBody.getStatusCode() == HttpStatus.NOT_FOUND) {
throw new KylinConnectionException(responseBody.getStatusCode(), responseBody.getBody());
} else {
log.error("error,responseBody is " + responseBody);
}
} else {
return Callback.RETURN;
}
throw new KylinUnKnowException("responseBody is : " + responseBody);
}
代码示例来源:origin: top.wboost/common-kylin
public Connection getConnection(String projectName) {
try {
return driver.connect(jdbcUrl + projectName, info);
} catch (Exception e) {
log.error("getConnection : ", e);
throw new KylinJdbcException(e.getLocalizedMessage());
}
}
代码示例来源:origin: top.wboost/common-web
protected void autowired(BaseJpaServiceImpl service) {
Class<?> clazz = ClassUtils.getUserClass(service);
if (clazz.getSimpleName().indexOf("ServiceImpl") == -1) {
throw new SystemException("服务层类名必须以ServiceImpl结尾");
}
String className = clazz.getSimpleName().substring(0, clazz.getSimpleName().indexOf("ServiceImpl"));
className = Character.toLowerCase(className.charAt(0)) + className.substring(1, className.length());
String defaultBeanName = className + "Repository";
Object repository = SpringBeanUtil.getBean(defaultBeanName);
if (repository == null) {
log.warn("cant find bean:" + defaultBeanName + ",please check");
return;
}
if (repository instanceof BaseRepository) {
BaseRepository<?, ?> findRepository = (BaseRepository<?, ?>) repository;
log.info("auto config bean: " + defaultBeanName + " to service:" + clazz.getName());
service.setRepository(findRepository);
} else {
throw new BeanNotFindException(defaultBeanName, BaseRepository.class);
}
}
代码示例来源:origin: top.wboost/common-utils-web
public static Object getBean(String beanId) {
try {
return applicationContext.getBean(beanId);
} catch (Exception e) {
log.warn("spring bean :{} cant find.", beanId);
return null;
}
}
代码示例来源:origin: top.wboost/common-web
} catch (SystemCodeException throwable) {
MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
log.warn("SystemCodeException : {}", methodLog);
if (throwable.isWriteLog()) {
logManager.sendLog(methodLog);
} catch (AbstractBaseCodeException throwable) {
MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
log.warn("BaseCodeException : {}", methodLog);
if (throwable.isWriteLog()) {
logManager.sendLog(methodLog);
} catch (BaseException throwable) {
MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
log.warn("BaseException : {}", methodLog);
if (throwable.isWriteLog()) {
logManager.sendLog(methodLog);
} catch (Exception throwable) {
MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
log.error("Exception : {} ", methodLog.toString(), throwable);
logManager.sendLog(methodLog);
HtmlUtil.writerJson(HtmlUtil.getResponse(), ResponseUtil
} catch (Throwable throwable) {
MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
log.error("Throwable : {}", throwable);
logManager.sendLog(methodLog);
HtmlUtil.writerJson(HtmlUtil.getResponse(),
代码示例来源:origin: top.wboost/common-utils
/**
* MD5加密
* @param 要加密的文本(utf-8编码)
* @return 加密后的文本
*/
public static String sha(String plainText) {
String result = null;
try {
result = StringUtil.bytes2HexString(
MessageDigest.getInstance("sha-1").digest(plainText.getBytes(SystemUtil.FILE_ENCODING)));
} catch (Exception e) {
log.error(e.getLocalizedMessage());
}
return result;
}
代码示例来源:origin: top.wboost/common-web
protected void autowired(BaseJpaServiceImpl service) {
Class<?> clazz = ClassUtils.getUserClass(service);
Object repository = null;
Class<?> genericInterfaces = ReflectUtil.getGenericInterfaces(clazz, 1);
repository = SpringBeanUtil.getBean(genericInterfaces);
String defaultBeanName = null;
if (repository == null) {
if (clazz.getSimpleName().indexOf("ServiceImpl") == -1) {
throw new SystemException("服务层类名必须以ServiceImpl结尾");
}
String className = clazz.getSimpleName().substring(0, clazz.getSimpleName().indexOf("ServiceImpl"));
className = Character.toLowerCase(className.charAt(0)) + className.substring(1, className.length());
defaultBeanName = className + "Repository";
repository = SpringBeanUtil.getBean(defaultBeanName);
if (repository == null) {
log.warn("cant find bean:" + defaultBeanName + ",please check");
return;
}
} else {
defaultBeanName = genericInterfaces.getName();
}
if (repository != null && repository instanceof BaseRepository) {
BaseRepository<?, ?> findRepository = (BaseRepository<?, ?>) repository;
log.info("auto config bean: " + defaultBeanName + " to service:" + clazz.getName());
service.setRepository(findRepository);
} else {
throw new BeanNotFindException(defaultBeanName, BaseRepository.class);
}
}
代码示例来源:origin: top.wboost/common-boost
@Override
@Explain(exceptionCode = 0, value = "boost")
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response) {
if (log.isDebugEnabled()) {
log.debug("boostHandler handle...");
}
return handleInternal(request, response);
}
代码示例来源:origin: top.wboost/common-web
public static boolean check(ResponseEntity<String> response) {
if (response == null || response.getStatusCode() != HttpStatus.OK)
return false;
String body = response.getBody();
if (!StringUtil.notEmpty(body)) {
return false;
}
try {
JSONObject jobj = JSONObject.parseObject(body);
int status = jobj.getInteger("status");
if (status == ResultStatus.SUCCESS.getValue()) {
return true;
}
} catch (Exception e) {
if (log.isWarnEnabled()) {
log.warn("body:{},exception is : {}", body, e.getLocalizedMessage());
}
}
return false;
}
代码示例来源:origin: top.wboost/common-utils-web
public static Object getBean(String beanId) {
try {
Object bean = applicationContext.getBean(beanId);
return bean;
} catch (Exception e) {
log.warn("mvc spring bean :{} cant find.", beanId);
return null;
}
}
代码示例来源:origin: top.wboost/common-utils-web
@Override
public void setApplicationContext(ApplicationContext arg0) throws BeansException {
applicationContext = arg0;
log.info("init");
}
代码示例来源:origin: top.wboost/common-boost
/**
* 执行并组装sql语句
* @param sql 要执行的sql语句
* @return
*/
protected List<Map<String, Object>> executeSqlAuto(Map<String, Object> replaceMap, String sql) {
List<String> autoFieldsName = sqlWildCardManager.getAutoFieldsNames(sql);
log.debug("auto get fieldsName:{}", autoFieldsName);
return executeSql(replaceMap, sql, autoFieldsName.toArray(new String[autoFieldsName.size()]));
}
代码示例来源:origin: top.wboost/common-web
/**
* 读取配置文件信息
*/
private void loadMessage() {
log.debug("init code and message...");
Properties messageProperties = PropertiesUtil.loadProperties(this.realMessagePath);
for (Entry<Object, Object> businessCode : messageProperties.entrySet()) {
try {
Integer code = Integer.valueOf((String) businessCode.getKey());
String message = (String) businessCode.getValue();
codeMessageMap.put(code, message == null ? "" : message);
} catch (Exception e) {
log.error("key : {},value: {} ,error is : {}", businessCode.getKey(), businessCode.getValue(),
e.getLocalizedMessage());
}
}
log.debug("init code and message end...");
}
代码示例来源:origin: top.wboost/common-utils
/**
* MD5加密
* @param 要加密的文本(utf-8编码)
* @return 加密后的文本
*/
public static String md5(String plainText) {
String result = null;
try {
result = StringUtil.bytes2HexString(
MessageDigest.getInstance("md5").digest(plainText.getBytes(SystemUtil.FILE_ENCODING)));
} catch (Exception e) {
log.error(e.getLocalizedMessage());
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!