org.codehaus.cargo.util.log.Logger.warn()方法的使用及代码示例

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

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

Logger.warn介绍

[英]Logger warning messages.
[中]记录器警告消息。

代码示例

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat

/**
 * Configures the specified context element with the extra classpath (if any) of the given WAR.
 * @param deployable Deployable to create extra classpath XML token for.
 * @param context The context element to configure, must not be {@code null}.
 */
protected void configureExtraClasspathToken(WAR deployable, Element context)
{
  getLogger().warn("Tomcat 5.x doesn't support extra classpath on WARs",
    this.getClass().getName());
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Creates the extra classpath XML token.
 * @param deployable Deployable to create extra classpath XML token for.
 * @return Extra classpath XML token.
 */
protected String getExtraClasspathToken(WAR deployable)
{
  getLogger().warn("Tomcat 5.x doesn't support extra classpath on WARs",
    this.getClass().getName());
  return "";
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Configures the specified context element with the extra classpath (if any) of the given WAR.
 * @param deployable Deployable to create extra classpath XML token for.
 * @param context The context element to configure, must not be {@code null}.
 */
protected void configureExtraClasspathToken(WAR deployable, Element context)
{
  getLogger().warn("Tomcat 5.x doesn't support extra classpath on WARs",
    this.getClass().getName());
}

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat

/**
 * Creates the extra classpath XML token.
 * @param deployable Deployable to create extra classpath XML token for.
 * @return Extra classpath XML token.
 */
protected String getExtraClasspathToken(WAR deployable)
{
  getLogger().warn("Tomcat 5.x doesn't support extra classpath on WARs",
    this.getClass().getName());
  return "";
}

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jonas

/**
   * If necessary, warn the user about this deployer's limitations.
   */
  protected void warn()
  {
    if (this.warn)
    {
      getLogger().warn("The jonas5x local deployer requires the target JOnAS server to be in"
        + " development mode.", getClass().getName());
      getLogger().warn("", getClass().getName());
      getLogger().warn("If this is not the case, please use the jonas5x remote deployer.",
        getClass().getName());
      getLogger().warn("Note that the jonas5x remote deployer can be used on a local server"
        + " by setting the server name to localhost.", getClass().getName());
    }
  }
}

代码示例来源:origin: codehaus-cargo/cargo

/**
   * If necessary, warn the user about this deployer's limitations.
   */
  protected void warn()
  {
    if (this.warn)
    {
      getLogger().warn("The jonas5x local deployer requires the target JOnAS server to be in"
        + " development mode.", getClass().getName());
      getLogger().warn("", getClass().getName());
      getLogger().warn("If this is not the case, please use the jonas5x remote deployer.",
        getClass().getName());
      getLogger().warn("Note that the jonas5x remote deployer can be used on a local server"
        + " by setting the server name to localhost.", getClass().getName());
    }
  }
}

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jboss

/**
 * runs the thread.
 */
@Override
public void run()
{
  try
  {
    this.runAndThrow();
  }
  catch (Throwable t)
  {
    if (!this.stopped)
    {
      this.lastException = t;
      this.logger.warn("Error in the embedded HTTP server: " + t.toString(),
        this.getClass().getName());
      for (StackTraceElement ste : t.getStackTrace())
      {
        this.logger.warn(ste.toString(), this.getClass().getName());
      }
    }
  }
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * runs the thread.
 */
@Override
public void run()
{
  try
  {
    this.runAndThrow();
  }
  catch (Throwable t)
  {
    if (!this.stopped)
    {
      this.lastException = t;
      this.logger.warn("Error in the embedded HTTP server: " + t.toString(),
        this.getClass().getName());
      for (StackTraceElement ste : t.getStackTrace())
      {
        this.logger.warn(ste.toString(), this.getClass().getName());
      }
    }
  }
}

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-wildfly

/**
 * @param jndiName JNDI name to be sanitized.
 * @return Sanitized JNDI name.
 */
private String sanitizeJndiName(String jndiName)
{
  String response = jndiName;
  if (!jndiName.startsWith("java:/"))
  {
    response = "java:/" + jndiName;
    getConfiguration().getLogger().warn("WildFly requires resource JNDI names "
      + "to start with java:/, hence changing the given JNDI name to: " + response,
      this.getClass().getName());
  }
  return response;
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * @param jndiName JNDI name to be sanitized.
 * @return Sanitized JNDI name.
 */
private String sanitizeJndiName(String jndiName)
{
  String response = jndiName;
  if (!jndiName.startsWith("java:/"))
  {
    response = "java:/" + jndiName;
    getConfiguration().getLogger().warn("WildFly requires resource JNDI names "
      + "to start with java:/, hence changing the given JNDI name to: " + response,
      this.getClass().getName());
  }
  return response;
}

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jetty

/**
   * @return Jetty <code>OPTIONS</code> argument.
   */
  protected synchronized String getOptions()
  {
    if (this.options == null)
    {
      StringBuilder options = new StringBuilder("OPTIONS=Server");

      File jspLib = new File(getHome(), "lib/jsp");
      if (jspLib.isDirectory())
      {
        options.append(",jsp");
      }
      else
      {
        getLogger().warn("JSP librairies not found in " + jspLib
          + ", JSP support will be disabled", this.getClass().getName());
      }

      options.append("," + this.defaultFinalOptions);
      this.options = options.toString();
    }

    return this.options;
  }
}

代码示例来源:origin: codehaus-cargo/cargo

/**
   * @return Jetty <code>OPTIONS</code> argument.
   */
  protected synchronized String getOptions()
  {
    if (this.options == null)
    {
      StringBuilder options = new StringBuilder("OPTIONS=Server");

      File jspLib = new File(getHome(), "lib/jsp");
      if (jspLib.isDirectory())
      {
        options.append(",jsp");
      }
      else
      {
        getLogger().warn("JSP librairies not found in " + jspLib
          + ", JSP support will be disabled", this.getClass().getName());
      }

      options.append("," + this.defaultFinalOptions);
      this.options = options.toString();
    }

    return this.options;
  }
}

代码示例来源:origin: org.codehaus.cargo/cargo-ant

/**
 * Calculate the absolute directory for any given path. This method will also emit a warning if
 * the given path is not absolute.
 * @param type Directory type, for example <code>container home</code>.
 * @param directory Directory path.
 * @return Absolute directory path.
 */
private String calculateAbsoluteDirectory(String type, String directory)
{
  File directoryFile = new File(directory);
  if (!directoryFile.isAbsolute())
  {
    String absoluteDirectory = directoryFile.getAbsolutePath();
    if (getLogger() != null)
    {
      getLogger().warn("The provided " + type + " directory [" + directory
        + "] is not an absolute directory. Replacing it with its absolute directory "
          + "counterpart, i.e. [" + absoluteDirectory + "] To avoid this message in "
            + "the future, you can also use the ${basedir} variable in your "
              + "paths.", this.getClass().getName());
    }
    return absoluteDirectory;
  }
  else
  {
    return directory;
  }
}

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-wildfly

/**
 * Create module from JAR file and add it to the script list.
 * @param jarFile JAR resource representing module.
 * @param container Container with modules.
 * @param configurationScript List of configuration scripts to be executed.
 */
protected void addModuleScript(String jarFile, InstalledLocalContainer container,
  List<ScriptCommand> configurationScript)
{
  String moduleName = WildFlyModuleUtils.getModuleName(container, jarFile);
  boolean isModuleDeployed = WildFlyModuleUtils.isModuleDeployed(container, jarFile);
  if (isModuleDeployed)
  {
    getLogger().warn("Module " + moduleName + " already exists, skipping it.",
        this.getClass().getName());
  }
  else
  {
    // Dependencies needed for DataSource driver initialization.
    List<String> commonDependencies = Arrays.asList("javax.api", "javax.transaction.api");
    List<String> dependencies = new ArrayList<String>();
    dependencies.addAll(commonDependencies);
    dependencies.addAll(modules);
    configurationScript.add(getConfigurationFactory().addModuleScript(moduleName,
        Arrays.asList(jarFile), dependencies));
  }
  modules.add(moduleName);
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Create module from JAR file and add it to the script list.
 * @param jarFile JAR resource representing module.
 * @param container Container with modules.
 * @param configurationScript List of configuration scripts to be executed.
 */
protected void addModuleScript(String jarFile, InstalledLocalContainer container,
  List<ScriptCommand> configurationScript)
{
  String moduleName = WildFlyModuleUtils.getModuleName(container, jarFile);
  boolean isModuleDeployed = WildFlyModuleUtils.isModuleDeployed(container, jarFile);
  if (isModuleDeployed)
  {
    getLogger().warn("Module " + moduleName + " already exists, skipping it.",
        this.getClass().getName());
  }
  else
  {
    // Dependencies needed for DataSource driver initialization.
    List<String> commonDependencies = Arrays.asList("javax.api", "javax.transaction.api");
    List<String> dependencies = new ArrayList<String>();
    dependencies.addAll(commonDependencies);
    dependencies.addAll(modules);
    configurationScript.add(getConfigurationFactory().addModuleScript(moduleName,
        Arrays.asList(jarFile), dependencies));
  }
  modules.add(moduleName);
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Warn user and throw an Exception if any unsupported {@link Resource}s are setup for this
 * configuration.
 */
public void collectUnsupportedResourcesAndThrowException()
{
  if (!getResources().isEmpty()
    && !this.getCapability().supportsProperty(ResourcePropertySet.RESOURCE))
  {
    StringBuilder errorMessage = new StringBuilder();
    for (Resource resource : getResources())
    {
      String message =
        "This configuration does not support Resource configuration! JndiName: "
          + resource.getName();
      getLogger().warn(message, getClass().getName());
      if (!errorMessage.toString().equals(""))
      {
        errorMessage.append("\n");
      }
      errorMessage.append(message);
    }
    throw new CargoException(errorMessage.toString());
  }
}

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Add option of spawn if property exists
 * 
 * @param java the predefined JVM launcher which will spawn
 */
private void addSpawn(JvmLauncher java)
{
  boolean spawnProcess = Boolean.parseBoolean(getConfiguration().getPropertyValue(
    GeneralPropertySet.SPAWN_PROCESS));
  if (spawnProcess)
  {
    if (getOutput() == null)
    {
      java.setSpawn(spawnProcess);
    }
    else
    {
      getLogger().warn("Process cannot be spawned unless output is null",
        this.getClass().getName());
    }
  }
}

代码示例来源:origin: org.codehaus.cargo/cargo-core-api-module

/**
 * Checks the versions of the servlet API in each descriptor, and logs a warning if a mismatch
 * might result in the loss of definitions.
 * 
 * @param theWebXml The descriptor that will be merged with the original
 */
protected final void checkServletVersions(WebXml theWebXml)
{
  if (this.webXml.getVersion() != null
    && this.webXml.getVersion().compareTo(theWebXml.getVersion()) < 0)
  {
    getLogger().warn("Merging elements from a version " + theWebXml.getVersion()
      + " descriptor into a version " + this.webXml.getVersion()
      + ", some elements may be skipped", this.getClass().getName());
  }
}

代码示例来源:origin: com.atlassian.sdk/ap3-api

@Override
  public void run()
  {
    try
    {
      if (container != null && (org.codehaus.cargo.container.State.STARTED == container.getState() || org.codehaus.cargo.container.State.STARTING == container.getState()))
      {
        log.info("Stopping container...","");
        container.stop();
      }
    }
    catch (Exception e)
    {
      log.warn("Failed stopping the container", "");
    }
  }
});

代码示例来源:origin: codehaus-cargo/cargo

/**
 * Checks the versions of the servlet API in each descriptor, and logs a warning if a mismatch
 * might result in the loss of definitions.
 * 
 * @param theWebXml The descriptor that will be merged with the original
 */
protected final void checkServletVersions(WebXml theWebXml)
{
  if (this.webXml.getVersion() != null
    && this.webXml.getVersion().compareTo(theWebXml.getVersion()) < 0)
  {
    getLogger().warn("Merging elements from a version " + theWebXml.getVersion()
      + " descriptor into a version " + this.webXml.getVersion()
      + ", some elements may be skipped", this.getClass().getName());
  }
}

相关文章

微信公众号

最新文章

更多