top.wboost.common.log.entity.Logger类的使用及代码示例

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

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

Logger介绍

[英]Logger 日志接口
[中]记录器日志接口

代码示例

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

  1. @Override
  2. public void setApplicationContext(ApplicationContext arg0) throws BeansException {
  3. applicationContext = arg0;
  4. log.info("init");
  5. }

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

  1. public static void debug() {
  2. StackTraceElement[] stacks = (new Throwable()).getStackTrace();
  3. for (StackTraceElement stack : stacks) {
  4. log.debug(stack.getClassName() + "-" + stack.getMethodName());
  5. }
  6. }

代码示例来源: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-web

  1. public HttpRequestBuilder addParameter(final String name, final String value, Boolean canEmpty) {
  2. if ((!canEmpty) && (!StringUtil.notEmpty(value))) {
  3. if (log.isDebugEnabled()) {
  4. log.debug("{} cant empty and value is empty. ignore", name);
  5. return this;
  6. }
  7. }
  8. return addParameter(new BasicNameValuePair(name, value));
  9. }

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

  1. @Override
  2. public boolean checkParameter(Annotation parameterConfig, Object arg) {
  3. if (parameterConfig.annotationType().isAnnotationPresent(ParameterConfig.class)) {
  4. ParameterConfigChecker checker = parameterConfigMap.get(parameterConfig.annotationType());
  5. if (checker == null) {
  6. throw new BusinessException();
  7. }
  8. return checker.check(arg, parameterConfig, "");
  9. }
  10. if (log.isWarnEnabled()) {
  11. log.warn("Annotation {} is not a parameterConfig annotation", parameterConfig);
  12. }
  13. return false;
  14. }

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

  1. public void afterPropertiesSet() throws Exception {
  2. log.info("properties config check init...");
  3. if (notNullMap != null) {
  4. for (Map.Entry<String, String> nutNullEntry : notNullMap.entrySet()) {
  5. propertiesVal = PropertiesUtil.getProperty(nutNullEntry.getKey(), nutNullEntry.getValue());
  6. log.debug("find notNullMap properties : {} in {} , value is {}.", nutNullEntry.getKey(),
  7. nutNullEntry.getValue(), propertiesVal);
  8. if (StringUtil.notEmpty(propertiesVal)) {
  9. propertiesVal = PropertiesUtil.getProperty(canNullEntry.getKey(), canNullEntry.getValue());
  10. log.debug("find canNullMap properties : {} in {} , value is {}.", canNullEntry.getKey(),
  11. canNullEntry.getValue(), propertiesVal);
  12. if (propertiesVal == null) {
  13. log.info("all properties check success");

代码示例来源: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-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-web

  1. protected void autowired(BaseJpaServiceImpl service) {
  2. Class<?> clazz = ClassUtils.getUserClass(service);
  3. if (clazz.getSimpleName().indexOf("ServiceImpl") == -1) {
  4. throw new SystemException("服务层类名必须以ServiceImpl结尾");
  5. }
  6. String className = clazz.getSimpleName().substring(0, clazz.getSimpleName().indexOf("ServiceImpl"));
  7. className = Character.toLowerCase(className.charAt(0)) + className.substring(1, className.length());
  8. String defaultBeanName = className + "Repository";
  9. Object repository = SpringBeanUtil.getBean(defaultBeanName);
  10. if (repository == null) {
  11. log.warn("cant find bean:" + defaultBeanName + ",please check");
  12. return;
  13. }
  14. if (repository instanceof BaseRepository) {
  15. BaseRepository<?, ?> findRepository = (BaseRepository<?, ?>) repository;
  16. log.info("auto config bean: " + defaultBeanName + " to service:" + clazz.getName());
  17. service.setRepository(findRepository);
  18. } else {
  19. throw new BeanNotFindException(defaultBeanName, BaseRepository.class);
  20. }
  21. }

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

  1. public static Object getBean(String beanId) {
  2. try {
  3. return applicationContext.getBean(beanId);
  4. } catch (Exception e) {
  5. log.warn("spring bean :{} cant find.", beanId);
  6. return null;
  7. }
  8. }

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

  1. } catch (SystemCodeException throwable) {
  2. MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
  3. log.warn("SystemCodeException : {}", methodLog);
  4. if (throwable.isWriteLog()) {
  5. logManager.sendLog(methodLog);
  6. } catch (AbstractBaseCodeException throwable) {
  7. MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
  8. log.warn("BaseCodeException : {}", methodLog);
  9. if (throwable.isWriteLog()) {
  10. logManager.sendLog(methodLog);
  11. } catch (BaseException throwable) {
  12. MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
  13. log.warn("BaseException : {}", methodLog);
  14. if (throwable.isWriteLog()) {
  15. logManager.sendLog(methodLog);
  16. } catch (Exception throwable) {
  17. MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
  18. log.error("Exception : {} ", methodLog.toString(), throwable);
  19. logManager.sendLog(methodLog);
  20. HtmlUtil.writerJson(HtmlUtil.getResponse(), ResponseUtil
  21. } catch (Throwable throwable) {
  22. MethodLog methodLog = getThrowableLog(proceedingJoinPoint, throwable);
  23. log.error("Throwable : {}", throwable);
  24. logManager.sendLog(methodLog);
  25. HtmlUtil.writerJson(HtmlUtil.getResponse(),

代码示例来源: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-web

  1. protected void autowired(BaseJpaServiceImpl service) {
  2. Class<?> clazz = ClassUtils.getUserClass(service);
  3. Object repository = null;
  4. Class<?> genericInterfaces = ReflectUtil.getGenericInterfaces(clazz, 1);
  5. repository = SpringBeanUtil.getBean(genericInterfaces);
  6. String defaultBeanName = null;
  7. if (repository == null) {
  8. if (clazz.getSimpleName().indexOf("ServiceImpl") == -1) {
  9. throw new SystemException("服务层类名必须以ServiceImpl结尾");
  10. }
  11. String className = clazz.getSimpleName().substring(0, clazz.getSimpleName().indexOf("ServiceImpl"));
  12. className = Character.toLowerCase(className.charAt(0)) + className.substring(1, className.length());
  13. defaultBeanName = className + "Repository";
  14. repository = SpringBeanUtil.getBean(defaultBeanName);
  15. if (repository == null) {
  16. log.warn("cant find bean:" + defaultBeanName + ",please check");
  17. return;
  18. }
  19. } else {
  20. defaultBeanName = genericInterfaces.getName();
  21. }
  22. if (repository != null && repository instanceof BaseRepository) {
  23. BaseRepository<?, ?> findRepository = (BaseRepository<?, ?>) repository;
  24. log.info("auto config bean: " + defaultBeanName + " to service:" + clazz.getName());
  25. service.setRepository(findRepository);
  26. } else {
  27. throw new BeanNotFindException(defaultBeanName, BaseRepository.class);
  28. }
  29. }

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

  1. @Override
  2. @Explain(exceptionCode = 0, value = "boost")
  3. public ModelAndView handle(HttpServletRequest request, HttpServletResponse response) {
  4. if (log.isDebugEnabled()) {
  5. log.debug("boostHandler handle...");
  6. }
  7. return handleInternal(request, response);
  8. }

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

  1. public static boolean check(ResponseEntity<String> response) {
  2. if (response == null || response.getStatusCode() != HttpStatus.OK)
  3. return false;
  4. String body = response.getBody();
  5. if (!StringUtil.notEmpty(body)) {
  6. return false;
  7. }
  8. try {
  9. JSONObject jobj = JSONObject.parseObject(body);
  10. int status = jobj.getInteger("status");
  11. if (status == ResultStatus.SUCCESS.getValue()) {
  12. return true;
  13. }
  14. } catch (Exception e) {
  15. if (log.isWarnEnabled()) {
  16. log.warn("body:{},exception is : {}", body, e.getLocalizedMessage());
  17. }
  18. }
  19. return false;
  20. }

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

  1. public static Object getBean(String beanId) {
  2. try {
  3. Object bean = applicationContext.getBean(beanId);
  4. return bean;
  5. } catch (Exception e) {
  6. log.warn("mvc spring bean :{} cant find.", beanId);
  7. return null;
  8. }
  9. }

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

  1. @Override
  2. public void setApplicationContext(ApplicationContext arg0) throws BeansException {
  3. applicationContext = arg0;
  4. log.info("init");
  5. }

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

  1. /**
  2. * 执行并组装sql语句
  3. * @param sql 要执行的sql语句
  4. * @return
  5. */
  6. protected List<Map<String, Object>> executeSqlAuto(Map<String, Object> replaceMap, String sql) {
  7. List<String> autoFieldsName = sqlWildCardManager.getAutoFieldsNames(sql);
  8. log.debug("auto get fieldsName:{}", autoFieldsName);
  9. return executeSql(replaceMap, sql, autoFieldsName.toArray(new String[autoFieldsName.size()]));
  10. }

代码示例来源: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-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. }

相关文章