/**
   * Log a message on the Logger associated with our Container (if any).
   *
   * @param message Message to be logged
   */
  protected void log(String message) {

    Logger logger = null;
    if (container != null) logger = container.getLogger();
    if (logger != null) logger.log("StandardPipeline[" + container.getName() + "]: " + message);
    else System.out.println("StandardPipeline[" + container.getName() + "]: " + message);
  }
  /**
   * Log a message on the Logger associated with our Container (if any).
   *
   * @param message Message to be logged
   * @param throwable Associated exception
   */
  protected void log(String message, Throwable throwable) {

    Logger logger = context.getLogger();
    if (logger != null)
      logger.log("Authenticator[" + context.getPath() + "]: " + message, throwable);
    else {
      System.out.println("Authenticator[" + context.getPath() + "]: " + message);
      throwable.printStackTrace(System.out);
    }
  }
  /**
   * Log a message on the Logger associated with our Container (if any).
   *
   * @param message Message to be logged
   * @param throwable Associated exception
   */
  protected void log(String message, Throwable throwable) {

    Logger logger = null;
    if (container != null) logger = container.getLogger();
    if (logger != null)
      logger.log("StandardPipeline[" + container.getName() + "]: " + message, throwable);
    else {
      System.out.println("StandardPipeline[" + container.getName() + "]: " + message);
      throwable.printStackTrace(System.out);
    }
  }
  /**
   * Log the specified message to our current Logger (if any).
   *
   * @param message Message to be logged
   */
  protected void log(String message) {

    if (!(container instanceof Container)) {
      System.out.println(logName() + ": " + message);
      return;
    }

    Logger logger = ((Container) container).getLogger();
    if (logger != null) logger.log(logName() + ": " + message);
    else System.out.println(logName() + ": " + message);
  }
  /**
   * Log a message on the Logger associated with our Container (if any)
   *
   * @param message Message to be logged
   */
  protected void log(String message) {

    Logger logger = null;
    String name = null;
    if (container != null) {
      logger = container.getLogger();
      name = container.getName();
    }

    if (logger != null) {
      logger.log(getName() + "[" + name + "]: " + message);
    } else {
      System.out.println(getName() + "[" + name + "]: " + message);
    }
  }
  /**
   * Log the specified message and exception to our current Logger (if any).
   *
   * @param message Message to be logged
   * @param throwable Related exception
   */
  protected void log(String message, Throwable throwable) {

    if (!(container instanceof Container)) {
      System.out.println(logName() + ": " + message + ": " + throwable);
      throwable.printStackTrace(System.out);
      return;
    }

    Logger logger = ((Container) container).getLogger();
    if (logger != null) logger.log(logName() + ": " + message, throwable);
    else {
      System.out.println(logName() + ": " + message + ": " + throwable);
      throwable.printStackTrace(System.out);
    }
  }
  /**
   * Logs the given message to the Logger associated with the Container (if any) of this
   * StandardPipeline.
   *
   * @param message the message
   * @param t the Throwable
   */
  protected void log(String message, Throwable t) {
    org.apache.catalina.Logger logger = null;
    if (container != null) {
      logger = container.getLogger();

      String msg =
          MessageFormat.format(
              rb.getString(STANDARD_PIPELINE_INFO), new Object[] {container.getName(), message});

      if (logger != null) {
        logger.log(msg, t, org.apache.catalina.Logger.WARNING);
      } else {
        log.log(Level.WARNING, msg, t);
      }
    } else {
      String msg = MessageFormat.format(rb.getString(STANDARD_PIPELINE_NULL_INFO), message);
      log.log(Level.WARNING, msg, t); // INFO set to WARNING
    }
  }
  /**
   * Log a message on the Logger associated with our Container (if any).
   *
   * @param message Message to be logged
   */
  protected void log(String message) {
    org.apache.catalina.Logger logger = null;
    if (container != null) {
      logger = container.getLogger();

      String msg =
          MessageFormat.format(
              rb.getString(STANDARD_PIPELINE_INFO), new Object[] {container.getName(), message});

      if (logger != null) {
        logger.log(msg);
      } else {
        if (log.isLoggable(Level.INFO)) {
          log.log(Level.INFO, msg);
        }
      }
    } else {
      if (log.isLoggable(Level.INFO)) {
        String msg = MessageFormat.format(rb.getString(STANDARD_PIPELINE_NULL_INFO), message);
        log.log(Level.INFO, msg);
      }
    }
  }
Exemple #9
0
  /**
   * Create an <code>ObjectName</code> for this <code>Logger</code> object.
   *
   * @param domain Domain in which this name is to be created
   * @param logger The Logger to be named
   * @exception MalformedObjectNameException if a name cannot be created
   */
  static ObjectName createObjectName(String domain, org.apache.catalina.Logger logger)
      throws MalformedObjectNameException {

    ObjectName name = null;
    Container container = logger.getContainer();

    if (container instanceof Engine) {
      name = new ObjectName(domain + ":type=Logger");
    } else if (container instanceof Host) {
      name = new ObjectName(domain + ":type=Logger,host=" + container.getName());
    } else if (container instanceof Context) {
      String path = ((Context) container).getPath();
      if (path.length() < 1) {
        path = "/";
      }
      Host host = (Host) container.getParent();
      name = new ObjectName(domain + ":type=Logger,path=" + path + ",host=" + host.getName());
    }

    return (name);
  }
  /**
   * Log a message on the Logger associated with our Container (if any).
   *
   * @param message Message to be logged
   */
  protected void log(String message) {

    Logger logger = context.getLogger();
    if (logger != null) logger.log("Authenticator[" + context.getPath() + "]: " + message);
    else System.out.println("Authenticator[" + context.getPath() + "]: " + message);
  }
  private void internalLog(String message, Throwable throwable) {

    Logger logger = context.getLogger();
    if (logger != null) logger.log(message, throwable);
  }
 private void internalLog(Exception exception, String message) {
   Logger logger = context.getLogger();
   if (logger != null) logger.log(exception, message);
 }
  /**
   * Log a message on the Logger associated with our Container (if any)
   *
   * @param message Message to be logged
   * @param throwable Associated exception
   */
  private void log(String message, Throwable throwable) {

    Logger logger = connector.getContainer().getLogger();
    if (logger != null) logger.log(threadName + " " + message, throwable);
  }