Package ch.qos.logback.core.status

Examples of ch.qos.logback.core.status.WarnStatus


  public void addWarn(String msg) {
    addStatus(new WarnStatus(msg, this));
  }

  public void addWarn(String msg, Throwable ex) {
    addStatus(new WarnStatus(msg, this, ex));
  }
View Full Code Here


  private void gzCompress(String nameOfFile2gz, String nameOfgzedFile) {
    File file2gz = new File(nameOfFile2gz);

    if (!file2gz.exists()) {
      addStatus(new WarnStatus("The file to compress named [" + nameOfFile2gz
          + "] does not exist.", this));

      return;
    }

    if (!nameOfgzedFile.endsWith(".gz")) {
      nameOfgzedFile = nameOfgzedFile + ".gz";
    }

    File gzedFile = new File(nameOfgzedFile);

    if (gzedFile.exists()) {
      addStatus(new WarnStatus("The target compressed file named ["
          + nameOfgzedFile + "] exist already.", this));

      return;
    }

    try {
      FileOutputStream fos = new FileOutputStream(nameOfgzedFile);
      GZIPOutputStream gzos = new GZIPOutputStream(fos);
      FileInputStream fis = new FileInputStream(nameOfFile2gz);
      byte[] inbuf = new byte[8102];
      int n;

      while ((n = fis.read(inbuf)) != -1) {
        gzos.write(inbuf, 0, n);
      }

      fis.close();
      gzos.close();

      if (!file2gz.delete()) {
        addStatus(new WarnStatus("Could not delete [" + nameOfFile2gz + "].",
            this));
      }
    } catch (Exception e) {
      addStatus(new ErrorStatus("Error occurred while compressing ["
          + nameOfFile2gz + "] into [" + nameOfgzedFile + "].", this, e));
View Full Code Here

    if (filename == null) {
      String jettyHomeProperty = OptionHelper.getSystemProperty("jetty.home");

      filename = jettyHomeProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
      getStatusManager().add(
          new WarnStatus("filename property not set. Assuming [" + filename
              + "]", this));

    }
    try {
      File configFile = new File(filename);
View Full Code Here

    if (filename == null) {
      String jettyHomeProperty = OptionHelper.getSystemProperty("jetty.home");

      filename = jettyHomeProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
      getStatusManager().add(
          new WarnStatus("filename property not set. Assuming [" + filename + "]", this));

    }

    try {
      File configFile = new File(filename);
View Full Code Here

  }

  final void noAppenderDefinedWarning(final Logger logger) {
    if (noAppenderWarning++ == 0) {
      getStatusManager().add(
          new WarnStatus("No appenders present in context [" + getName()
              + "] for logger [" + logger.getName() + "].", logger));
    }
  }
View Full Code Here

    } catch (IOException e) {
      sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]",
              loggerContext, e));
    }
    if (urlList != null && urlList.size() > 1) {
      sm.add(new WarnStatus("Resource [" + resourceName + "] occurs multiple times on the classpath.",
              loggerContext));
      for (URL url : urlList) {
        sm.add(new WarnStatus("Resource [" + resourceName + "] occurs at [" + url.toString() + "]",
                loggerContext));
      }
    }
  }
View Full Code Here

      URL url = urlByResourceName(sm, jndiEntryForConfigResource);
      if (url == null) {
        String msg = "The jndi resource [" + jndiEntryForConfigResource
            + "] for context [" + loggerContext.getName()
            + "] does not lead to a valid file";
        sm.add(new WarnStatus(msg, this));
      }
      return url;
    } else {
      String resourceByConvention = conventionalConfigFileName(loggerContext
          .getName());
View Full Code Here

        // TODO can we do better than printing a stack trace on syserr?
        e.printStackTrace();
      }
    } else {
      getStatusManager().add(
          new WarnStatus("[" + filename + "] does not exist", this));
    }

    if (!quiet) {
      StatusPrinter.print(getStatusManager());
    }
View Full Code Here

        // TODO can we do better than printing a stack trace on syserr?
        e.printStackTrace();
      }
    } else {
      getStatusManager().add(
          new WarnStatus("[" + filename + "] does not exist", this));
    }

    if (!quiet) {
      StatusPrinter.print(getStatusManager());
    }
View Full Code Here

    if (filename == null) {
      String jettyHomeProperty = OptionHelper.getSystemProperty("jetty.home");

      filename = jettyHomeProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
      getStatusManager().add(
          new WarnStatus("filename property not set. Assuming [" + filename
              + "]", this));

    }
    try {
      File configFile = new File(filename);
View Full Code Here

TOP

Related Classes of ch.qos.logback.core.status.WarnStatus

Copyright © 2018 www.massapicom. 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.