Package ch.qos.logback.core.status

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


    try {
      guard.set(true);

      if (!this.started) {
        if (statusRepeatCount++ < ALLOWED_REPEATS) {
          addStatus(new WarnStatus(
              "Attempted to append to non started appender [" + name + "].",
              this));
        }
        return;
      }
View Full Code Here


  public void addInfo(String msg, Throwable ex) {
    addStatus(new InfoStatus(msg, getDeclaredOrigin(), ex));
  }

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

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

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

  private void zipCompress(String nameOfFile2zip, String nameOfZippedFile, String innerEntryName) {
    File file2zip = new File(nameOfFile2zip);

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

      return;
    }

    if (innerEntryName == null) {
      addStatus(new WarnStatus("The innerEntryName parameter cannot be null", this));
      return;
    }

    if (!nameOfZippedFile.endsWith(".zip")) {
      nameOfZippedFile = nameOfZippedFile + ".zip";
    }

    File zippedFile = new File(nameOfZippedFile);

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

      return;
    }

    addInfo("ZIP compressing [" + file2zip + "] as ["+zippedFile+"]");
    createMissingTargetDirsIfNecessary(zippedFile);

    BufferedInputStream bis = null;
    ZipOutputStream zos = null;
    try {
      bis = new BufferedInputStream(new FileInputStream(nameOfFile2zip));
      zos = new ZipOutputStream(new FileOutputStream(nameOfZippedFile));

      ZipEntry zipEntry = computeZipEntry(innerEntryName);
      zos.putNextEntry(zipEntry);

      byte[] inbuf = new byte[BUFFER_SIZE];
      int n;

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

      bis.close();
      bis = null;
      zos.close();
      zos = null;

      if (!file2zip.delete()) {
        addStatus(new WarnStatus("Could not delete [" + nameOfFile2zip + "].",
                this));
      }
    } catch (Exception e) {
      addStatus(new ErrorStatus("Error occurred while compressing ["
              + nameOfFile2zip + "] into [" + nameOfZippedFile + "].", this, e));
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()) {
      addWarn("The target compressed file named ["
              + nameOfgzedFile + "] exist already. Aborting file compression.");
      return;
    }

    addInfo("GZ compressing [" + file2gz + "] as ["+gzedFile+"]");
    createMissingTargetDirsIfNecessary(gzedFile);

    BufferedInputStream bis = null;
    GZIPOutputStream gzos = null;
    try {
      bis = new BufferedInputStream(new FileInputStream(nameOfFile2gz));
      gzos = new GZIPOutputStream(new FileOutputStream(nameOfgzedFile));
      byte[] inbuf = new byte[BUFFER_SIZE];
      int n;

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

      bis.close();
      bis = null;
      gzos.close();
      gzos = null;

      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

    try {
      guard.set(true);

      if (!this.started) {
        if (statusRepeatCount++ < ALLOWED_REPEATS) {
          addStatus(new WarnStatus(
              "Attempted to append to non started appender [" + name + "].",
              this));
        }
        return;
      }
View Full Code Here

    try {
      guard = true;

      if (!this.started) {
        if (statusRepeatCount++ < ALLOWED_REPEATS) {
          addStatus(new WarnStatus(
              "Attempted to append to non started appender [" + name + "].",
              this));
        }
        return;
      }
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

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.