top.wboost.common.log.entity.Logger.error()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(645)

本文整理了Java中top.wboost.common.log.entity.Logger.error()方法的一些代码示例,展示了Logger.error()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()方法的具体详情如下:
包路径:top.wboost.common.log.entity.Logger
类名称:Logger
方法名:error

Logger.error介绍

暂无

代码示例

代码示例来源:origin: top.wboost/common-kylin

  1. public Connection getConnection(String projectName) {
  2. try {
  3. return driver.connect(jdbcUrl + projectName, info);
  4. } catch (Exception e) {
  5. log.error("getConnection : ", e);
  6. throw new KylinJdbcException(e.getLocalizedMessage());
  7. }
  8. }

代码示例来源:origin: top.wboost/common-utils

  1. /**
  2. * MD5加密
  3. * @param 要加密的文本(utf-8编码)
  4. * @return 加密后的文本
  5. */
  6. public static String sha(String plainText) {
  7. String result = null;
  8. try {
  9. result = StringUtil.bytes2HexString(
  10. MessageDigest.getInstance("sha-1").digest(plainText.getBytes(SystemUtil.FILE_ENCODING)));
  11. } catch (Exception e) {
  12. log.error(e.getLocalizedMessage());
  13. }
  14. return result;
  15. }

代码示例来源:origin: top.wboost/common-utils

  1. /**
  2. * MD5加密
  3. * @param 要加密的文本(utf-8编码)
  4. * @return 加密后的文本
  5. */
  6. public static String md5(String plainText) {
  7. String result = null;
  8. try {
  9. result = StringUtil.bytes2HexString(
  10. MessageDigest.getInstance("md5").digest(plainText.getBytes(SystemUtil.FILE_ENCODING)));
  11. } catch (Exception e) {
  12. log.error(e.getLocalizedMessage());
  13. }
  14. return result;
  15. }

代码示例来源:origin: top.wboost/common-web

  1. private static String replaceMessage(String message, Object... params) {
  2. if (message == null)
  3. return message;
  4. try {
  5. Object[] replaceParams = params;
  6. List<String> replaceList = StringUtil.getPatternMattcherList(message, PATTERN_COMPILE, 1);
  7. for (String replaceIndex : replaceList) {
  8. int index = Integer.parseInt(replaceIndex);
  9. if (replaceParams != null && index < replaceParams.length && index >= 0) {
  10. message = message.replaceAll("\\{" + index + "\\}", replaceParams[index].toString());
  11. } else {
  12. message = message.replaceAll("\\{" + index + "\\}", "");
  13. }
  14. }
  15. } catch (Exception e) {
  16. log.error(" replace message error ,{}", e.getLocalizedMessage());
  17. }
  18. return message.trim();
  19. }

代码示例来源:origin: top.wboost/common-utils

  1. public static <K, V> Map<K, V> copyMapByNeed(Map<K, V> copyMap, String... needNames) {
  2. Assert.notNull(copyMap, "bean is null");
  3. Map<K, V> returnMap = new HashMap<>();
  4. try {
  5. for (Map.Entry<K, V> entry : copyMap.entrySet()) {
  6. if (!checkName(entry.getKey(), needNames)) {
  7. returnMap.put(entry.getKey(), entry.getValue());
  8. }
  9. }
  10. return returnMap;
  11. } catch (Exception e) {
  12. log.error(e.getLocalizedMessage());
  13. return null;
  14. }
  15. }

代码示例来源:origin: top.wboost/common-utils

  1. public static List<JSONObject> copyByJSONObject(List<JSONObject> copyList, String... needNames) {
  2. Assert.notNull(copyList, "bean is null");
  3. List<JSONObject> returnList = new ArrayList<>();
  4. try {
  5. for (JSONObject copyMap : copyList) {
  6. returnList.add(copyByJSONObject(copyMap, needNames));
  7. }
  8. return returnList;
  9. } catch (Exception e) {
  10. log.error(e.getLocalizedMessage());
  11. return null;
  12. }
  13. }

代码示例来源:origin: top.wboost/common-web

  1. /**
  2. * 读取配置文件信息
  3. */
  4. private void loadMessage() {
  5. log.debug("init code and message...");
  6. Properties messageProperties = PropertiesUtil.loadProperties(this.realMessagePath);
  7. for (Entry<Object, Object> businessCode : messageProperties.entrySet()) {
  8. try {
  9. Integer code = Integer.valueOf((String) businessCode.getKey());
  10. String message = (String) businessCode.getValue();
  11. codeMessageMap.put(code, message == null ? "" : message);
  12. } catch (Exception e) {
  13. log.error("key : {},value: {} ,error is : {}", businessCode.getKey(), businessCode.getValue(),
  14. e.getLocalizedMessage());
  15. }
  16. }
  17. log.debug("init code and message end...");
  18. }

代码示例来源:origin: top.wboost/common-web

  1. public static void loadMessageByPath(String path) {
  2. log.debug("loadMessageByPath... {}", path);
  3. Properties messageProperties = PropertiesUtil.loadProperties(path);
  4. for (Entry<Object, Object> businessCode : messageProperties.entrySet()) {
  5. try {
  6. Integer code = Integer.valueOf((String) businessCode.getKey());
  7. String message = (String) businessCode.getValue();
  8. codeMessageMap.put(code, message == null ? "" : message);
  9. } catch (Exception e) {
  10. log.error("key : {},value: {} ,error is : {}", businessCode.getKey(), businessCode.getValue(),
  11. e.getLocalizedMessage());
  12. }
  13. }
  14. log.debug("loadMessageByPath end...");
  15. }

代码示例来源:origin: top.wboost/common-utils

  1. public static <K, V> List<Map<K, V>> copyMapByMapList(List<Map<K, V>> copyList, String... needNames) {
  2. Assert.notNull(copyList, "bean is null");
  3. List<Map<K, V>> returnList = new ArrayList<>();
  4. try {
  5. for (Map<K, V> copyMap : copyList) {
  6. Map<K, V> returnMap = new HashMap<>();
  7. for (Map.Entry<K, V> entry : copyMap.entrySet()) {
  8. if (!checkName(entry.getKey(), needNames)) {
  9. returnMap.put(entry.getKey(), entry.getValue());
  10. }
  11. }
  12. returnList.add(returnMap);
  13. }
  14. return returnList;
  15. } catch (Exception e) {
  16. log.error(e.getLocalizedMessage());
  17. return null;
  18. }
  19. }

代码示例来源:origin: top.wboost/common-utils

  1. public static JSONObject copyByJSONObject(JSONObject copyMap, String... needNames) {
  2. Assert.notNull(copyMap, "bean is null");
  3. try {
  4. JSONObject returnMap = new JSONObject();
  5. for (Map.Entry<String, Object> entry : copyMap.entrySet()) {
  6. if (!checkName(entry.getKey(), needNames)) {
  7. returnMap.put(entry.getKey(), entry.getValue());
  8. }
  9. }
  10. return returnMap;
  11. } catch (Exception e) {
  12. log.error(e.getLocalizedMessage());
  13. return null;
  14. }
  15. }

代码示例来源:origin: top.wboost/common-web

  1. public void onRootApplicationEvent(ContextRefreshedEvent event) {
  2. if (SpringBeanUtil.getApplicationContext() == null) {
  3. throw new RuntimeException("SpringBeanUtil ApplicationContext 不存在,请检查SpringBeanUtil是否配置");
  4. }
  5. for (Entry<String, Object> entry : invokeMap.entrySet()) {
  6. try {
  7. SpringInitedInvoke springInitedInvoke = (SpringInitedInvoke) SpringBeanUtil
  8. .getBean(Class.forName(entry.getKey()));
  9. if (springInitedInvoke == null) {
  10. throw new RuntimeException("未获得:" + entry.getKey());
  11. }
  12. springInitedInvoke.apply(entry.getValue());
  13. } catch (Exception e) {
  14. log.error(e.getLocalizedMessage());
  15. }
  16. }
  17. }
  18. }

代码示例来源:origin: top.wboost/common-utils-web

  1. private static EncodedResource[] loadResources(String location) {
  2. try {
  3. Resource[] resources = resourceResolver.getResources(location);
  4. EncodedResource[] encodeResources = new EncodedResource[resources.length];
  5. for (int i = 0; i < resources.length; i++) {
  6. Resource resource = resources[i];
  7. encodeResources[i] = new EncodedResource(resource, CharsetEnum.UTF_8.getCharset());
  8. }
  9. return encodeResources;
  10. } catch (Exception e) {
  11. log.error("loadResource error", e);
  12. throw new BusinessException("loadResource error");
  13. }
  14. }

代码示例来源:origin: top.wboost/common-web

  1. /**
  2. * 根据id修改单个属性
  3. * @date 2016年10月13日下午8:17:47
  4. * @param id
  5. * 修改资源id
  6. * @param key
  7. * 修改资源key
  8. * @param value
  9. * 修改资源value
  10. */
  11. public void updateById(String id, Field key, Object value) {
  12. if (key == null) {
  13. throw new RuntimeException("NO FIELD!");
  14. }
  15. T t = getBaseRepository().getOne(id);
  16. if (t == null) {
  17. log.debug("method:updateById entity is undefined");
  18. return;
  19. }
  20. try {
  21. ReflectUtil.getWriteMethod(t.getClass(), key.getName()).invoke(t, value);
  22. getRepository().save(t);
  23. } catch (Exception e) {
  24. log.error(e.getMessage());
  25. }
  26. }

代码示例来源:origin: top.wboost/common-kylin

  1. private Callback checkResult(ResponseEntity<String> responseBody) {
  2. if (responseBody.getStatusCode() != HttpStatus.OK) {
  3. if (responseBody.getStatusCode() == HttpStatus.UNAUTHORIZED) {
  4. if (!checkAuthentication()) {
  5. log.info("kylin UNAUTHORIZED ,now doAuthentication");
  6. if (doAuthentication()) {
  7. log.info("restart executeQuery");
  8. return Callback.RESTART;
  9. }
  10. } else {
  11. log.error("UNAUTHORIZED");
  12. throw new KylinAuthenticationException(String.valueOf(responseBody.getStatusCodeValue()));
  13. }
  14. } else if (responseBody.getStatusCode() == HttpStatus.NOT_FOUND) {
  15. throw new KylinConnectionException(responseBody.getStatusCode(), responseBody.getBody());
  16. } else {
  17. log.error("error,responseBody is " + responseBody);
  18. }
  19. } else {
  20. return Callback.RETURN;
  21. }
  22. throw new KylinUnKnowException("responseBody is : " + responseBody);
  23. }

代码示例来源:origin: top.wboost/common-web

  1. /**
  2. * 根据id修改单个属性
  3. * @date 2016年10月13日下午8:17:47
  4. * @param id
  5. * 修改资源id
  6. * @param key
  7. * 修改资源key
  8. * @param value
  9. * 修改资源value
  10. */
  11. public void updateById(ID id, Field key, Object value) {
  12. if (key == null) {
  13. throw new RuntimeException("NO FIELD!");
  14. }
  15. T t = getBaseRepository().getOne(id);
  16. if (t == null) {
  17. log.debug("method:updateById entity is undefined");
  18. return;
  19. }
  20. try {
  21. ReflectUtil.getWriteMethod(t.getClass(), key.getName()).invoke(t, value);
  22. getRepository().save(t);
  23. } catch (Exception e) {
  24. log.error(e.getMessage());
  25. }
  26. }

代码示例来源:origin: top.wboost/common-utils

  1. /**
  2. * 复制一个bean
  3. * @param clazz
  4. * @param bean
  5. * @param filterNames
  6. * @return
  7. */
  8. public static <T> T copyBean(Class<T> clazz, T bean, String... filterNames) {
  9. Assert.notNull(bean, "bean is null");
  10. Assert.notNull(clazz, "clazz is null");
  11. try {
  12. T instance = ReflectUtil.newInstance(clazz);
  13. List<Method> allReadMethod = ReflectUtil.getAllReadMethod(clazz);
  14. for (Method method : allReadMethod) {
  15. if (checkField(method, filterNames)) {
  16. Method writeMethod = ReflectUtil.getWriteMethodByRead(clazz, method);
  17. if (writeMethod != null) {
  18. writeMethod.invoke(instance, method.invoke(bean));
  19. }
  20. }
  21. }
  22. return instance;
  23. } catch (Exception e) {
  24. log.error(e.getLocalizedMessage());
  25. return null;
  26. }
  27. }

代码示例来源:origin: top.wboost/common-utils

  1. /**
  2. * 复制一个bean
  3. * @param clazz
  4. * @param bean
  5. * @param filterNames
  6. * @return
  7. */
  8. public static <T> T copyBeanByNeed(Class<T> clazz, T bean, String... needNames) {
  9. Assert.notNull(bean, "bean is null");
  10. Assert.notNull(clazz, "clazz is null");
  11. try {
  12. T instance = ReflectUtil.newInstance(clazz);
  13. List<Method> allReadMethod = ReflectUtil.getAllReadMethod(clazz);
  14. for (Method method : allReadMethod) {
  15. if (!checkField(method, needNames)) {
  16. Method writeMethod = ReflectUtil.getWriteMethodByRead(clazz, method);
  17. if (writeMethod != null) {
  18. writeMethod.invoke(instance, method.invoke(bean));
  19. }
  20. }
  21. }
  22. return instance;
  23. } catch (Exception e) {
  24. log.error(e.getLocalizedMessage());
  25. return null;
  26. }
  27. }

代码示例来源:origin: top.wboost/common-web

  1. @Override
  2. public ResultEntity resolve(ResultEntity resolveEntity) {
  3. if (resolveEntity.getInfo().getFunctionEntity().getFunctionParams() == null) {
  4. log.error("resolveEntity redicturl is null");
  5. } else {
  6. resolveEntity.getInfo().getFunctionEntity()
  7. .setEval("alert(\"" + getMessage() + "\");window.location.href=\""
  8. + resolveEntity.getInfo().getFunctionEntity().getFunctionParams() + "\"");
  9. String message = getMessageByCode(resolveEntity.getInfo().getCode(), resolveEntity.getPromptMessage());
  10. resolveEntity.getInfo().setMessage(message);
  11. }
  12. return resolveEntity;
  13. }
  14. }

代码示例来源:origin: top.wboost/common-web

  1. @Override
  2. public ResultEntity resolve(ResultEntity resolveEntity) {
  3. if (resolveEntity.getInfo().getFunctionEntity().getFunctionParams() == null) {
  4. log.error("resolveEntity redicturl is null");
  5. } else {
  6. resolveEntity.setStatus(ResultStatus.SUCCESS.getValue());
  7. resolveEntity.setValidate(null);
  8. String restAndRedirectUrl = resolveEntity.getInfo().getFunctionEntity().getFunctionParams();
  9. String[] urlArray = restAndRedirectUrl.split(",");
  10. String restUrl;
  11. String redirectUrl;
  12. if (urlArray.length == 1) {
  13. restUrl = urlArray[0];
  14. redirectUrl = restUrl;
  15. } else {
  16. restUrl = urlArray[0];
  17. redirectUrl = urlArray[1];
  18. }
  19. resolveEntity.getInfo().getFunctionEntity()
  20. .setEval("alert(\"" + getMessage() + "\");window.location.href=\"" + redirectUrl + "\"")
  21. .setData(new QuickHashMap<String, String>().quickPut(REST_URL, restUrl));
  22. String message = getMessageByCode(resolveEntity.getInfo().getCode(), resolveEntity.getPromptMessage());
  23. resolveEntity.getInfo().setMessage(message);
  24. }
  25. return resolveEntity;
  26. }
  27. }

代码示例来源:origin: top.wboost/common-web

  1. @Override
  2. public ResultEntity resolve(ResultEntity resolveEntity) {
  3. if (resolveEntity.getInfo().getFunctionEntity().getFunctionParams() == null) {
  4. log.error("resolveEntity redicturl is null");
  5. } else {
  6. String restAndRedirectUrl = resolveEntity.getInfo().getFunctionEntity().getFunctionParams();
  7. String[] urlArray = restAndRedirectUrl.split(",");
  8. String restUrl;
  9. String redirectUrl;
  10. if (urlArray.length == 1) {
  11. restUrl = urlArray[0];
  12. redirectUrl = restUrl;
  13. } else {
  14. restUrl = urlArray[0];
  15. redirectUrl = urlArray[1];
  16. }
  17. String urlPrefix = StringUtil.getAllPatternMattcher(restUrl, pattern, 1);
  18. String requestContext = urlPrefix + "://" + StringUtil.getAllPatternMattcher(restUrl, pattern, 2);
  19. String service = StringUtil.getAllPatternMattcher(restUrl, pattern, 3);
  20. resolveEntity.getInfo().getFunctionEntity()
  21. .setEval("alert(\"" + getMessage() + "\");window.location.href=\"" + redirectUrl + "\"")
  22. .setData(new QuickHashMap<String, String>().quickPut(SERVICE, service).quickPut(REST_URL,
  23. requestContext));
  24. String message = getMessageByCode(resolveEntity.getInfo().getCode(), resolveEntity.getPromptMessage());
  25. resolveEntity.getInfo().setMessage(message);
  26. }
  27. return resolveEntity;
  28. }
  29. }

相关文章