本文整理了Java中top.wboost.common.log.entity.Logger.error()
方法的一些代码示例,展示了Logger.error()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()
方法的具体详情如下:
包路径:top.wboost.common.log.entity.Logger
类名称:Logger
方法名:error
暂无
代码示例来源: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-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-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;
}
代码示例来源:origin: top.wboost/common-web
private static String replaceMessage(String message, Object... params) {
if (message == null)
return message;
try {
Object[] replaceParams = params;
List<String> replaceList = StringUtil.getPatternMattcherList(message, PATTERN_COMPILE, 1);
for (String replaceIndex : replaceList) {
int index = Integer.parseInt(replaceIndex);
if (replaceParams != null && index < replaceParams.length && index >= 0) {
message = message.replaceAll("\\{" + index + "\\}", replaceParams[index].toString());
} else {
message = message.replaceAll("\\{" + index + "\\}", "");
}
}
} catch (Exception e) {
log.error(" replace message error ,{}", e.getLocalizedMessage());
}
return message.trim();
}
代码示例来源:origin: top.wboost/common-utils
public static <K, V> Map<K, V> copyMapByNeed(Map<K, V> copyMap, String... needNames) {
Assert.notNull(copyMap, "bean is null");
Map<K, V> returnMap = new HashMap<>();
try {
for (Map.Entry<K, V> entry : copyMap.entrySet()) {
if (!checkName(entry.getKey(), needNames)) {
returnMap.put(entry.getKey(), entry.getValue());
}
}
return returnMap;
} catch (Exception e) {
log.error(e.getLocalizedMessage());
return null;
}
}
代码示例来源:origin: top.wboost/common-utils
public static List<JSONObject> copyByJSONObject(List<JSONObject> copyList, String... needNames) {
Assert.notNull(copyList, "bean is null");
List<JSONObject> returnList = new ArrayList<>();
try {
for (JSONObject copyMap : copyList) {
returnList.add(copyByJSONObject(copyMap, needNames));
}
return returnList;
} catch (Exception e) {
log.error(e.getLocalizedMessage());
return null;
}
}
代码示例来源: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-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-utils
public static <K, V> List<Map<K, V>> copyMapByMapList(List<Map<K, V>> copyList, String... needNames) {
Assert.notNull(copyList, "bean is null");
List<Map<K, V>> returnList = new ArrayList<>();
try {
for (Map<K, V> copyMap : copyList) {
Map<K, V> returnMap = new HashMap<>();
for (Map.Entry<K, V> entry : copyMap.entrySet()) {
if (!checkName(entry.getKey(), needNames)) {
returnMap.put(entry.getKey(), entry.getValue());
}
}
returnList.add(returnMap);
}
return returnList;
} catch (Exception e) {
log.error(e.getLocalizedMessage());
return null;
}
}
代码示例来源:origin: top.wboost/common-utils
public static JSONObject copyByJSONObject(JSONObject copyMap, String... needNames) {
Assert.notNull(copyMap, "bean is null");
try {
JSONObject returnMap = new JSONObject();
for (Map.Entry<String, Object> entry : copyMap.entrySet()) {
if (!checkName(entry.getKey(), needNames)) {
returnMap.put(entry.getKey(), entry.getValue());
}
}
return returnMap;
} catch (Exception e) {
log.error(e.getLocalizedMessage());
return null;
}
}
代码示例来源:origin: top.wboost/common-web
public void onRootApplicationEvent(ContextRefreshedEvent event) {
if (SpringBeanUtil.getApplicationContext() == null) {
throw new RuntimeException("SpringBeanUtil ApplicationContext 不存在,请检查SpringBeanUtil是否配置");
}
for (Entry<String, Object> entry : invokeMap.entrySet()) {
try {
SpringInitedInvoke springInitedInvoke = (SpringInitedInvoke) SpringBeanUtil
.getBean(Class.forName(entry.getKey()));
if (springInitedInvoke == null) {
throw new RuntimeException("未获得:" + entry.getKey());
}
springInitedInvoke.apply(entry.getValue());
} catch (Exception e) {
log.error(e.getLocalizedMessage());
}
}
}
}
代码示例来源:origin: top.wboost/common-utils-web
private static EncodedResource[] loadResources(String location) {
try {
Resource[] resources = resourceResolver.getResources(location);
EncodedResource[] encodeResources = new EncodedResource[resources.length];
for (int i = 0; i < resources.length; i++) {
Resource resource = resources[i];
encodeResources[i] = new EncodedResource(resource, CharsetEnum.UTF_8.getCharset());
}
return encodeResources;
} catch (Exception e) {
log.error("loadResource error", e);
throw new BusinessException("loadResource error");
}
}
代码示例来源:origin: top.wboost/common-web
/**
* 根据id修改单个属性
* @date 2016年10月13日下午8:17:47
* @param id
* 修改资源id
* @param key
* 修改资源key
* @param value
* 修改资源value
*/
public void updateById(String id, Field key, Object value) {
if (key == null) {
throw new RuntimeException("NO FIELD!");
}
T t = getBaseRepository().getOne(id);
if (t == null) {
log.debug("method:updateById entity is undefined");
return;
}
try {
ReflectUtil.getWriteMethod(t.getClass(), key.getName()).invoke(t, value);
getRepository().save(t);
} catch (Exception e) {
log.error(e.getMessage());
}
}
代码示例来源: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-web
/**
* 根据id修改单个属性
* @date 2016年10月13日下午8:17:47
* @param id
* 修改资源id
* @param key
* 修改资源key
* @param value
* 修改资源value
*/
public void updateById(ID id, Field key, Object value) {
if (key == null) {
throw new RuntimeException("NO FIELD!");
}
T t = getBaseRepository().getOne(id);
if (t == null) {
log.debug("method:updateById entity is undefined");
return;
}
try {
ReflectUtil.getWriteMethod(t.getClass(), key.getName()).invoke(t, value);
getRepository().save(t);
} catch (Exception e) {
log.error(e.getMessage());
}
}
代码示例来源:origin: top.wboost/common-utils
/**
* 复制一个bean
* @param clazz
* @param bean
* @param filterNames
* @return
*/
public static <T> T copyBean(Class<T> clazz, T bean, String... filterNames) {
Assert.notNull(bean, "bean is null");
Assert.notNull(clazz, "clazz is null");
try {
T instance = ReflectUtil.newInstance(clazz);
List<Method> allReadMethod = ReflectUtil.getAllReadMethod(clazz);
for (Method method : allReadMethod) {
if (checkField(method, filterNames)) {
Method writeMethod = ReflectUtil.getWriteMethodByRead(clazz, method);
if (writeMethod != null) {
writeMethod.invoke(instance, method.invoke(bean));
}
}
}
return instance;
} catch (Exception e) {
log.error(e.getLocalizedMessage());
return null;
}
}
代码示例来源:origin: top.wboost/common-utils
/**
* 复制一个bean
* @param clazz
* @param bean
* @param filterNames
* @return
*/
public static <T> T copyBeanByNeed(Class<T> clazz, T bean, String... needNames) {
Assert.notNull(bean, "bean is null");
Assert.notNull(clazz, "clazz is null");
try {
T instance = ReflectUtil.newInstance(clazz);
List<Method> allReadMethod = ReflectUtil.getAllReadMethod(clazz);
for (Method method : allReadMethod) {
if (!checkField(method, needNames)) {
Method writeMethod = ReflectUtil.getWriteMethodByRead(clazz, method);
if (writeMethod != null) {
writeMethod.invoke(instance, method.invoke(bean));
}
}
}
return instance;
} catch (Exception e) {
log.error(e.getLocalizedMessage());
return null;
}
}
代码示例来源:origin: top.wboost/common-web
@Override
public ResultEntity resolve(ResultEntity resolveEntity) {
if (resolveEntity.getInfo().getFunctionEntity().getFunctionParams() == null) {
log.error("resolveEntity redicturl is null");
} else {
resolveEntity.getInfo().getFunctionEntity()
.setEval("alert(\"" + getMessage() + "\");window.location.href=\""
+ resolveEntity.getInfo().getFunctionEntity().getFunctionParams() + "\"");
String message = getMessageByCode(resolveEntity.getInfo().getCode(), resolveEntity.getPromptMessage());
resolveEntity.getInfo().setMessage(message);
}
return resolveEntity;
}
}
代码示例来源:origin: top.wboost/common-web
@Override
public ResultEntity resolve(ResultEntity resolveEntity) {
if (resolveEntity.getInfo().getFunctionEntity().getFunctionParams() == null) {
log.error("resolveEntity redicturl is null");
} else {
resolveEntity.setStatus(ResultStatus.SUCCESS.getValue());
resolveEntity.setValidate(null);
String restAndRedirectUrl = resolveEntity.getInfo().getFunctionEntity().getFunctionParams();
String[] urlArray = restAndRedirectUrl.split(",");
String restUrl;
String redirectUrl;
if (urlArray.length == 1) {
restUrl = urlArray[0];
redirectUrl = restUrl;
} else {
restUrl = urlArray[0];
redirectUrl = urlArray[1];
}
resolveEntity.getInfo().getFunctionEntity()
.setEval("alert(\"" + getMessage() + "\");window.location.href=\"" + redirectUrl + "\"")
.setData(new QuickHashMap<String, String>().quickPut(REST_URL, restUrl));
String message = getMessageByCode(resolveEntity.getInfo().getCode(), resolveEntity.getPromptMessage());
resolveEntity.getInfo().setMessage(message);
}
return resolveEntity;
}
}
代码示例来源:origin: top.wboost/common-web
@Override
public ResultEntity resolve(ResultEntity resolveEntity) {
if (resolveEntity.getInfo().getFunctionEntity().getFunctionParams() == null) {
log.error("resolveEntity redicturl is null");
} else {
String restAndRedirectUrl = resolveEntity.getInfo().getFunctionEntity().getFunctionParams();
String[] urlArray = restAndRedirectUrl.split(",");
String restUrl;
String redirectUrl;
if (urlArray.length == 1) {
restUrl = urlArray[0];
redirectUrl = restUrl;
} else {
restUrl = urlArray[0];
redirectUrl = urlArray[1];
}
String urlPrefix = StringUtil.getAllPatternMattcher(restUrl, pattern, 1);
String requestContext = urlPrefix + "://" + StringUtil.getAllPatternMattcher(restUrl, pattern, 2);
String service = StringUtil.getAllPatternMattcher(restUrl, pattern, 3);
resolveEntity.getInfo().getFunctionEntity()
.setEval("alert(\"" + getMessage() + "\");window.location.href=\"" + redirectUrl + "\"")
.setData(new QuickHashMap<String, String>().quickPut(SERVICE, service).quickPut(REST_URL,
requestContext));
String message = getMessageByCode(resolveEntity.getInfo().getCode(), resolveEntity.getPromptMessage());
resolveEntity.getInfo().setMessage(message);
}
return resolveEntity;
}
}
内容来源于网络,如有侵权,请联系作者删除!