Examples of OLog


Examples of org.olat.core.logging.OLog

    // load the blacklist that should not be indexed
    Set<String> blacklist = new HashSet<String>();
    File blackListFile = new File(WebappHelper.getContextRoot() + CHELP_BLACKLIST_RELPATH);
    if (blackListFile.exists()) {
      // need another logger because of static class
      OLog log = Tracing.createLoggerFor(ContextHelpModule.class);
      try {
        FileInputStream fstream = new FileInputStream(blackListFile);
        DataInputStream in = new DataInputStream(fstream);
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String strLine;
        while ((strLine = br.readLine()) != null) {
          if (StringHelper.containsNonWhitespace(strLine)) {
            strLine = strLine.trim();
            if ( ! strLine.startsWith("#")) {
              blacklist.add(strLine.trim());
              log.info("Excluding chelp path::" + strLine + " - found on blacklist::" + blackListFile.getAbsolutePath());             
            }
          }
        }
        in.close();
      } catch (Exception e) {
        log.error("Error while reading chelp blacklist::" + blackListFile.getAbsolutePath(), e);
      }
    }
    return blacklist;
  }
View Full Code Here

Examples of org.olat.core.logging.OLog

  public void forceSetDebugLogLevel(boolean enabled) {
    if (!enabled) {
      forcedLogger = null;
      return;
    }
    forcedLogger = new OLog() {

      public void audit(String logMsg) {
        Tracing.logAudit(logMsg, DBImpl.class);
      }
View Full Code Here

Examples of org.olat.core.logging.OLog

    } catch (IOException e) {
      throw new OLATRuntimeException("Wiki page couldn't be read! Pagename:"+leaf.getName(), e);
    }
    String pageName = p.getProperty(WikiManager.PAGENAME);
    if(pageName == null){
      OLog log = Tracing.createLoggerFor(Wiki.class);
      log.warn("wiki properties page is persent but without content. Name:"+leaf.getName());
      return null;
    }
    WikiPage page = new WikiPage(pageName);
    page.setCreationTime(p.getProperty(WikiManager.C_TIME));
    page.setVersion(p.getProperty(WikiManager.VERSION));
View Full Code Here

Examples of org.olat.core.logging.OLog

   */
  @Override
  public String getDisplayOption() {
    // if nothing other defined, view content only, when a structure node
    // contains an html-file.
    OLog logger = Tracing.createLoggerFor(this.getClass());
    ModuleConfiguration config = getModuleConfiguration();
    String thisConf = super.getDisplayOption(false);
    if (thisConf == null
        && config.get(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE).equals(STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE)) {
      if (logger.isDebug()) {
        logger.debug("no displayOption set, use default (content)", thisConf);
      }
      return CourseNode.DISPLAY_OPTS_CONTENT;
    }
    if (logger.isDebug()) {
      logger.debug("there is a config set, use it: " + thisConf);
    }
    return super.getDisplayOption();
  }
View Full Code Here

Examples of org.olat.core.logging.OLog

  @SuppressWarnings({"unused", "unchecked"})
  @Override
  public boolean isValid(FormItem formItem, Map formContext) {
    boolean result;
    TextElement textElement = (TextElement)formItem;
    OLog log = Tracing.createLoggerFor(this.getClass());
    if (StringHelper.containsNonWhitespace(textElement.getValue())) {
      HttpClient httpClient = HttpClientFactory.getHttpClientInstance();
      HttpClientParams httpClientParams = httpClient.getParams();
      httpClientParams.setConnectionManagerTimeout(2500);
      httpClient.setParams(httpClientParams);
      try {
        // Could throw IllegalArgumentException if argument is not a valid url
        // (e.g. contains whitespaces)
        HttpMethod httpMethod = new GetMethod(XING_NAME_VALIDATION_URL + textElement.getValue());
        // Don't allow redirects since otherwise, we won't be able to get the correct status
        httpMethod.setFollowRedirects(false);
        // Get the user profile page
        httpClient.executeMethod(httpMethod);
        int httpStatusCode = httpMethod.getStatusCode();
        // Looking at the HTTP status code tells us whether a user with the given Xing name exists.
        if (httpStatusCode == HttpStatus.SC_OK) {
          // If the user exists, we get a 200...
          result = true;
        } else if (httpStatusCode == HttpStatus.SC_MOVED_PERMANENTLY) {
          // ... and if he doesn't exist, we get a 301.
          textElement.setErrorKey("form.name.xing.error", null);
          result = false;
        } else {
          // In case of any exception, assume that the given MSN name is valid (The opposite would block easily upon network problems), and inform the user about this.
          textElement.setExampleKey("form.example.xingname.notvalidated", null);
          log.warn("Xing name validation: Expected HTTP status 200 or 301, but got " + httpStatusCode);
          result = true;
        }
      } catch (IllegalArgumentException e) {
        // The xing name is not url compatible (e.g. contains whitespaces)
        textElement.setErrorKey("form.xingname.notvalid", null);
        result = false;
      } catch (Exception e) {
        // In case of any exception, assume that the given MSN name is valid (The opposite would block easily upon network problems), and inform the user about this.
        textElement.setExampleKey("form.example.xingname.notvalidated", null);
        log.warn("Xing name validation: Exception: " + e.getMessage());
        result = true;
      }
    } else {
      result = true;
    }
View Full Code Here

Examples of org.olat.core.logging.OLog

  @SuppressWarnings({"unchecked"})
  @Override
  public boolean isValid(FormItem formItem, Map formContext) {
    boolean result;
    TextElement textElement = (TextElement)formItem;
    OLog log = Tracing.createLoggerFor(this.getClass());
    if (StringHelper.containsNonWhitespace(textElement.getValue())) {
     
      // Use an HttpClient to fetch a profile information page from MSN.
      HttpClient httpClient = HttpClientFactory.getHttpClientInstance();
      HttpClientParams httpClientParams = httpClient.getParams();
      httpClientParams.setConnectionManagerTimeout(2500);
      httpClient.setParams(httpClientParams);
      HttpMethod httpMethod = new GetMethod(MSN_NAME_VALIDATION_URL);
      NameValuePair idParam = new NameValuePair(MSN_NAME_URL_PARAMETER, textElement.getValue());
      httpMethod.setQueryString(new NameValuePair[] {idParam});
      // Don't allow redirects since otherwise, we won't be able to get the correct status
      httpMethod.setFollowRedirects(false);
      try {
        // Get the user profile page
        httpClient.executeMethod(httpMethod);
        int httpStatusCode = httpMethod.getStatusCode();
        // Looking at the HTTP status code tells us whether a user with the given MSN name exists.
        if (httpStatusCode == HttpStatus.SC_MOVED_PERMANENTLY) {
          // If the user exists, we get a 301...
          result = true;
        } else if (httpStatusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
          // ...and if the user doesn't exist, MSN sends a 500.
          textElement.setErrorKey("form.name.msn.error", null);
          result = false;
        } else {
          // For HTTP status codes other than 301 and 500 we will assume that the given MSN name is valid, but inform the user about this.
          textElement.setExampleKey("form.example.msnname.notvalidated", null);
          log.warn("MSN name validation: Expected HTTP status 301 or 500, but got " + httpStatusCode);
          result = true;
        }
      } catch (Exception e) {
        // In case of any exception, assume that the given MSN name is valid (The opposite would block easily upon network problems), and inform the user about this.
        textElement.setExampleKey("form.example.msnname.notvalidated", null);
        log.warn("MSN name validation: Exception: " + e.getMessage());
        result = true;
      }
    } else {
      result = true;
    }
View Full Code Here

Examples of org.olat.core.logging.OLog

  @SuppressWarnings({"unchecked", "unused"})
  @Override
  public boolean isValid(FormItem formItem, Map formContext) {
    boolean result;
    TextElement textElement = (TextElement)formItem;
    OLog log = Tracing.createLoggerFor(this.getClass());
    if (StringHelper.containsNonWhitespace(textElement.getValue())) {
     
      // Use an HttpClient to fetch a profile information page from ICQ.
      HttpClient httpClient = HttpClientFactory.getHttpClientInstance();
      HttpClientParams httpClientParams = httpClient.getParams();
      httpClientParams.setConnectionManagerTimeout(2500);
      httpClient.setParams(httpClientParams);
      HttpMethod httpMethod = new GetMethod(ICQ_NAME_VALIDATION_URL);
      NameValuePair uinParam = new NameValuePair(ICQ_NAME_URL_PARAMETER, textElement.getValue());
      httpMethod.setQueryString(new NameValuePair[] {uinParam});
      // Don't allow redirects since otherwise, we won't be able to get the HTTP 302 further down.
      httpMethod.setFollowRedirects(false);
      try {
        // Get the user profile page
        httpClient.executeMethod(httpMethod);
        int httpStatusCode = httpMethod.getStatusCode();
        // Looking at the HTTP status code tells us whether a user with the given ICQ name exists.
        if (httpStatusCode == HttpStatus.SC_OK) {
          // ICQ tells us that a user name is valid if it sends an HTTP 200...
          result = true;
        } else if (httpStatusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
          // ...and if it's invalid, it sends an HTTP 302.
          textElement.setErrorKey("form.name.icq.error", null);
          result = false;
        } else {
          // For HTTP status codes other than 200 and 302 we will silently assume that the given ICQ name is valid, but inform the user about this.
          textElement.setExampleKey("form.example.icqname.notvalidated", null);
          log.warn("ICQ name validation: Expected HTTP status 200 or 301, but got " + httpStatusCode);
          result = true;
        }
      } catch (Exception e) {
        // In case of any exception, assume that the given ICQ name is valid (The opposite would block easily upon network problems), and inform the user about this.
        textElement.setExampleKey("form.example.icqname.notvalidated", null);
        log.warn("ICQ name validation: Exception: " + e.getMessage());
        result = true;
      }
    } else {
      result = true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.