org.codehaus.cargo.util.log.Logger类的使用及代码示例

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

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

Logger介绍

[英]Simple interface for logging and tracing. The reason we don't use commons-logging or some other logging library is because Cargo is a framework. As such we don't want to force the user to include an additional library and more importantly we want to remain open so that applications using Cargo will be able to adapt it to their favorite logging system, whatever that is.
[中]用于记录和跟踪的简单接口。我们不使用commons日志或其他日志库的原因是因为Cargo是一个框架。因此,我们不想强迫用户包括一个额外的库,更重要的是,我们希望保持开放,以便使用Cargo的应用程序能够将其适应于他们最喜欢的日志系统,不管是什么。

代码示例

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

/**
 * {@inheritDoc}
 */
@Override
public void setProperty(String name, String value)
{
  if (value != null)
  {
    getLogger().debug("Setting property [" + name + "] = [" + value + "]",
      this.getClass().getName());
    this.properties.put(name, value);
  }
  else
  {
    getLogger().debug("Removing property [" + name + "]", this.getClass().getName());
    this.properties.remove(name);
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
protected void activateLogging(LocalContainer container)
{
  getLogger().info("Jetty8x log configuration not implemented", 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: 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

getLogger().info("Deploying [" + deployable.getFile() + "] to [" + deployableDir + "]...",
  this.getClass().getName());
if (!getFileHandler().isDirectory(deployableDir))
String target = getFileHandler().append(deployableDir, getDeployableName(deployable));
if (deployable.isExpanded())
  if (getFileHandler().exists(target) && !getFileHandler().isDirectory(target))

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

if (classPath != null)
  String commonLib = getFileHandler().append(installedContainer.getHome(),
    "common/lib");
    String target = getFileHandler().append(commonLib,
      getFileHandler().getName(path));
    getLogger().debug("Copying extra classpath JAR to " + target,
      this.getClass().getName());

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

getLogger().debug("Sending WLST script: " + newLine + buffer.toString(),
  this.getClass().getName());
  getFileHandler().writeTextFile(tempFile.getAbsolutePath(), buffer.toString(), null);

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

/**
 * {@inheritDoc}
 */
@Override
protected void doConfigure(LocalContainer c) throws Exception
{
  InstalledLocalContainer container = (InstalledLocalContainer) c;
  setupConfigurationDir();
  // Copy initial configuration
  String initialConfiguration = getFileHandler().append(container.getHome(), "standalone");
  getFileHandler().copyDirectory(initialConfiguration, getHome());
  String configurationXmlFile = "configuration/"
      + getPropertyValue(JBossPropertySet.CONFIGURATION) + ".xml";
  String configurationXML = getFileHandler().append(getHome(), configurationXmlFile);
  if (!getFileHandler().exists(configurationXML))
  {
    throw new CargoException("Missing configuration XML file: " + configurationXML);
  }
  getLogger().info("Configuring JBoss using the ["
    + getPropertyValue(JBossPropertySet.CONFIGURATION) + "] server configuration",
      this.getClass().getName());
  // Set user properties.
  createMgmtUsersProperties();
  createApplicationUsersProperties();
  createApplicationRolesProperties();
}

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

/**
 * Delete old profile.
 * @throws Exception if any error is raised during deleting of profile
 */
private void deleteOldProfile() throws Exception
{
  getLogger().info("Deleting old profile.", this.getClass().getName());
  // Delete profile in WebSphere
  wsContainer.runManageProfileCommand(
    "-delete",
    "-profileName",
    getPropertyValue(WebSpherePropertySet.PROFILE));
  // Profile directory has to be deleted too.
  getLogger().debug("Deleting profile folder " + getHome(), this.getClass().getName());
  getFileHandler().delete(getHome());
  if (getFileHandler().isDirectory(getHome()))
  {
    throw new CargoException("Directory " + getHome() + " cannot be deleted");
  }
  // Update profile informations in WebSphere
  wsContainer.runManageProfileCommand("-validateAndUpdateRegistry");
}

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

/**
 * Undeploy the file in specified directory with the specified file name.
 * 
 * @param directory The directory name
 * @param file The file name
 */
private void undeployFile(String directory, String file)
{
  String fileName = getFileHandler().append(directory, file);
  if (fileExists(fileName))
  {
    getLogger().info("Undeploying [" + fileName + "]...", this.getClass().getName());
    getFileHandler().delete(fileName);
  }
  else
  {
    getLogger().info(
        "Couldn't not find file to undeploy [" + fileName + "]",
        this.getClass().getName());
  }
}

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

/**
 * Extract the context name from the WAR file name (without the file extension). For example if
 * the WAR is named <code>test.war</code> then the context name is <code>test</code>.
 */
private void parseContext()
{
  if (this.context == null)
  {
    String ctx = getFileHandler().getName(getFile());
    int warIndex = ctx.toLowerCase().lastIndexOf(".war");
    if (warIndex >= 0)
    {
      ctx = ctx.substring(0, warIndex);
    }
    getLogger().debug("Parsed web context = [" + ctx + "]", this.getClass().getName());
    setContext(ctx);
  }
}

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

/**
 * Construct the shared classpath XML based on the container.
 * 
 * @param container the JBoss container instance from which we'll find the JBoss installed files
 * to reference
 * @return Shared classpath XML based on the container.
 * @throws MalformedURLException If URL building fails.
 */
protected String getSharedClasspathXml(JBossInstalledLocalContainer container)
  throws MalformedURLException
{
  String[] sharedClassPath = container.getSharedClasspath();
  StringBuilder tmp = new StringBuilder();
  if (sharedClassPath != null)
  {
    for (String element : sharedClassPath)
    {
      String fileName = getFileHandler().getName(element);
      String directoryName = getFileHandler().getParent(element);
      URL directoryUrl = new File(directoryName).toURI().toURL();
      tmp.append("<classpath codebase=\"" + directoryUrl + "\" archives=\""
          + fileName + "\"/>");
      tmp.append("\n");
    }
  }
  String sharedClassPathString = tmp.toString();
  getLogger().debug("Shared loader classpath is " + sharedClassPathString,
    getClass().getName());
  return sharedClassPathString;
}

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

/**
 * Removes previously deployed artifact.
 * 
 * @param deployable artifact to undeploy
 */
@Override
public void undeploy(Deployable deployable)
{
  if (deployable.getType() != DeployableType.WAR)
  {
    super.undeploy(deployable);
    return;
  }
  WAR war = (WAR) deployable;
  String fileName =
    getFileHandler().append(getDeployableDir(deployable), war.getContext() + ".war");
  if (getFileHandler().exists(fileName))
  {
    getLogger().info("Undeploying [" + fileName + "]...", this.getClass().getName());
    getFileHandler().delete(fileName);
  }
}

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

/**
 * {@inheritDoc}. For JBoss container the target is the <code>deployments</code> directory.
 */
@Override
public String getDeployableDir(Deployable deployable)
{
  String altDeployDir = getContainer().getConfiguration().
  getPropertyValue(JBossPropertySet.ALTERNATIVE_DEPLOYMENT_DIR);
  if (altDeployDir != null && !"".equals(altDeployDir))
  {
    getContainer().getLogger().info("Using non-default deployment target directory "
      + altDeployDir, this.getClass().getName());
    return getFileHandler().append(getContainer().getConfiguration().getHome(),
      altDeployDir);
  }
  else
  {
    return getFileHandler().append(getContainer().
      getConfiguration().getHome(), "deployments");
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public void start(Deployable deployable)
{
  String file = deployable.getFile();
  getLogger().info("Starting [" + file + "]", this.getClass().getName());
  try
  {
    TomcatDeployableStatus status = getTomcatManager().getStatus(getPath(deployable));
    if (status.equals(TomcatDeployableStatus.STOPPED))
    {
      getTomcatManager().start(getPath(deployable));
    }
    else
    {
      getLogger().debug("Deployable [" + getPath(deployable)
        + "] already started or doesn't exist", this.getClass().getName());
    }
  }
  catch (IOException|TomcatManagerException exception)
  {
    throw new ContainerException("Failed to start [" + file + "]", exception);
  }
}

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

if (!getFileHandler().exists(downloadDir))
  getFileHandler().mkdirs(downloadDir);
getLogger().info("Downloading container from [" + this.remoteLocation + "] to ["
  + targetFile + "]", getClass().getName());

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

/**
 * {@inheritDoc}
 */
@Override
protected void doStart(JvmLauncher java) throws Exception
{
  final File swarmExecutable = new File(getHome());
  swarmJvmLauncher.setJarFile(swarmExecutable);
  swarmJvmLauncher.setWorkingDirectory(new File(getFileHandler().getAbsolutePath(
    getConfiguration().getHome())));
  final Configuration configuration = getConfiguration();
  String jvmArgs = configuration.getPropertyValue(GeneralPropertySet.JVMARGS);
  if (jvmArgs == null || !jvmArgs.contains("-Dswarm.http.port="))
  {
    swarmJvmLauncher.addJvmArguments("-Dswarm.http.port="
      + getConfiguration().getPropertyValue(ServletPropertySet.PORT));
  }
  WildFlySwarmStandaloneLocalConfiguration wildFlySwarmConfiguration =
      (WildFlySwarmStandaloneLocalConfiguration) configuration;
  File swarmProjectDescriptor = wildFlySwarmConfiguration.getSwarmProjectDescriptor();
  if (swarmProjectDescriptor != null && swarmProjectDescriptor.exists())
  {
    swarmJvmLauncher.addAppArgumentLine("-s "
      + swarmProjectDescriptor.getAbsolutePath());
  }
  addDeployables();
  getLogger().info("Swarm arg line: " + swarmJvmLauncher.getCommandLine(),
      getClass().getCanonicalName());
  swarmJvmLauncher.start();
}

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

/**
 * Create the Cargo logger that will be used for logging all messages. If the user has specified
 * a log file we create a File logger. If no file has been specified we use an Ant logger by
 * default to log to the Ant logging subsystem.
 */
private void createCargoLogger()
{
  if (getLog() != null)
  {
    this.logger = new FileLogger(getLog(), true);
  }
  else
  {
    // Use an Ant logger adapter to log to Ant
    this.logger = new AntLogger(getProject());
  }
  if (getLogLevel() != null)
  {
    this.logger.setLevel(getLogLevel());
  }
  else
  {
    this.logger.setLevel(LogLevel.INFO);
  }
}

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

if (classPath != null)
  String commonLib = getFileHandler().append(installedContainer.getHome(),
    "common/lib");
    String target = getFileHandler().append(commonLib,
      getFileHandler().getName(path));
    getLogger().debug("Copying extra classpath JAR to " + target,
      this.getClass().getName());

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

getLogger().debug("Sending WLST script: " + newLine + buffer.toString(),
  this.getClass().getName());
  getFileHandler().writeTextFile(tempFile.getAbsolutePath(), buffer.toString(), null);

相关文章

微信公众号

最新文章

更多