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

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

本文整理了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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setProperty(String name, String value)
  6. {
  7. if (value != null)
  8. {
  9. getLogger().debug("Setting property [" + name + "] = [" + value + "]",
  10. this.getClass().getName());
  11. this.properties.put(name, value);
  12. }
  13. else
  14. {
  15. getLogger().debug("Removing property [" + name + "]", this.getClass().getName());
  16. this.properties.remove(name);
  17. }
  18. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. protected void activateLogging(LocalContainer container)
  6. {
  7. getLogger().info("Jetty8x log configuration not implemented", this.getClass().getName());
  8. }

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

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

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

  1. @Override
  2. public void run()
  3. {
  4. try
  5. {
  6. if (container != null && (org.codehaus.cargo.container.State.STARTED == container.getState() || org.codehaus.cargo.container.State.STARTING == container.getState()))
  7. {
  8. log.info("Stopping container...","");
  9. container.stop();
  10. }
  11. }
  12. catch (Exception e)
  13. {
  14. log.warn("Failed stopping the container", "");
  15. }
  16. }
  17. });

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

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

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

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

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

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

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. protected void doConfigure(LocalContainer c) throws Exception
  6. {
  7. InstalledLocalContainer container = (InstalledLocalContainer) c;
  8. setupConfigurationDir();
  9. // Copy initial configuration
  10. String initialConfiguration = getFileHandler().append(container.getHome(), "standalone");
  11. getFileHandler().copyDirectory(initialConfiguration, getHome());
  12. String configurationXmlFile = "configuration/"
  13. + getPropertyValue(JBossPropertySet.CONFIGURATION) + ".xml";
  14. String configurationXML = getFileHandler().append(getHome(), configurationXmlFile);
  15. if (!getFileHandler().exists(configurationXML))
  16. {
  17. throw new CargoException("Missing configuration XML file: " + configurationXML);
  18. }
  19. getLogger().info("Configuring JBoss using the ["
  20. + getPropertyValue(JBossPropertySet.CONFIGURATION) + "] server configuration",
  21. this.getClass().getName());
  22. // Set user properties.
  23. createMgmtUsersProperties();
  24. createApplicationUsersProperties();
  25. createApplicationRolesProperties();
  26. }

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

  1. /**
  2. * Delete old profile.
  3. * @throws Exception if any error is raised during deleting of profile
  4. */
  5. private void deleteOldProfile() throws Exception
  6. {
  7. getLogger().info("Deleting old profile.", this.getClass().getName());
  8. // Delete profile in WebSphere
  9. wsContainer.runManageProfileCommand(
  10. "-delete",
  11. "-profileName",
  12. getPropertyValue(WebSpherePropertySet.PROFILE));
  13. // Profile directory has to be deleted too.
  14. getLogger().debug("Deleting profile folder " + getHome(), this.getClass().getName());
  15. getFileHandler().delete(getHome());
  16. if (getFileHandler().isDirectory(getHome()))
  17. {
  18. throw new CargoException("Directory " + getHome() + " cannot be deleted");
  19. }
  20. // Update profile informations in WebSphere
  21. wsContainer.runManageProfileCommand("-validateAndUpdateRegistry");
  22. }

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

  1. /**
  2. * Undeploy the file in specified directory with the specified file name.
  3. *
  4. * @param directory The directory name
  5. * @param file The file name
  6. */
  7. private void undeployFile(String directory, String file)
  8. {
  9. String fileName = getFileHandler().append(directory, file);
  10. if (fileExists(fileName))
  11. {
  12. getLogger().info("Undeploying [" + fileName + "]...", this.getClass().getName());
  13. getFileHandler().delete(fileName);
  14. }
  15. else
  16. {
  17. getLogger().info(
  18. "Couldn't not find file to undeploy [" + fileName + "]",
  19. this.getClass().getName());
  20. }
  21. }

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

  1. /**
  2. * Extract the context name from the WAR file name (without the file extension). For example if
  3. * the WAR is named <code>test.war</code> then the context name is <code>test</code>.
  4. */
  5. private void parseContext()
  6. {
  7. if (this.context == null)
  8. {
  9. String ctx = getFileHandler().getName(getFile());
  10. int warIndex = ctx.toLowerCase().lastIndexOf(".war");
  11. if (warIndex >= 0)
  12. {
  13. ctx = ctx.substring(0, warIndex);
  14. }
  15. getLogger().debug("Parsed web context = [" + ctx + "]", this.getClass().getName());
  16. setContext(ctx);
  17. }
  18. }

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

  1. /**
  2. * Construct the shared classpath XML based on the container.
  3. *
  4. * @param container the JBoss container instance from which we'll find the JBoss installed files
  5. * to reference
  6. * @return Shared classpath XML based on the container.
  7. * @throws MalformedURLException If URL building fails.
  8. */
  9. protected String getSharedClasspathXml(JBossInstalledLocalContainer container)
  10. throws MalformedURLException
  11. {
  12. String[] sharedClassPath = container.getSharedClasspath();
  13. StringBuilder tmp = new StringBuilder();
  14. if (sharedClassPath != null)
  15. {
  16. for (String element : sharedClassPath)
  17. {
  18. String fileName = getFileHandler().getName(element);
  19. String directoryName = getFileHandler().getParent(element);
  20. URL directoryUrl = new File(directoryName).toURI().toURL();
  21. tmp.append("<classpath codebase=\"" + directoryUrl + "\" archives=\""
  22. + fileName + "\"/>");
  23. tmp.append("\n");
  24. }
  25. }
  26. String sharedClassPathString = tmp.toString();
  27. getLogger().debug("Shared loader classpath is " + sharedClassPathString,
  28. getClass().getName());
  29. return sharedClassPathString;
  30. }

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

  1. /**
  2. * Removes previously deployed artifact.
  3. *
  4. * @param deployable artifact to undeploy
  5. */
  6. @Override
  7. public void undeploy(Deployable deployable)
  8. {
  9. if (deployable.getType() != DeployableType.WAR)
  10. {
  11. super.undeploy(deployable);
  12. return;
  13. }
  14. WAR war = (WAR) deployable;
  15. String fileName =
  16. getFileHandler().append(getDeployableDir(deployable), war.getContext() + ".war");
  17. if (getFileHandler().exists(fileName))
  18. {
  19. getLogger().info("Undeploying [" + fileName + "]...", this.getClass().getName());
  20. getFileHandler().delete(fileName);
  21. }
  22. }

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

  1. /**
  2. * {@inheritDoc}. For JBoss container the target is the <code>deployments</code> directory.
  3. */
  4. @Override
  5. public String getDeployableDir(Deployable deployable)
  6. {
  7. String altDeployDir = getContainer().getConfiguration().
  8. getPropertyValue(JBossPropertySet.ALTERNATIVE_DEPLOYMENT_DIR);
  9. if (altDeployDir != null && !"".equals(altDeployDir))
  10. {
  11. getContainer().getLogger().info("Using non-default deployment target directory "
  12. + altDeployDir, this.getClass().getName());
  13. return getFileHandler().append(getContainer().getConfiguration().getHome(),
  14. altDeployDir);
  15. }
  16. else
  17. {
  18. return getFileHandler().append(getContainer().
  19. getConfiguration().getHome(), "deployments");
  20. }
  21. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void start(Deployable deployable)
  6. {
  7. String file = deployable.getFile();
  8. getLogger().info("Starting [" + file + "]", this.getClass().getName());
  9. try
  10. {
  11. TomcatDeployableStatus status = getTomcatManager().getStatus(getPath(deployable));
  12. if (status.equals(TomcatDeployableStatus.STOPPED))
  13. {
  14. getTomcatManager().start(getPath(deployable));
  15. }
  16. else
  17. {
  18. getLogger().debug("Deployable [" + getPath(deployable)
  19. + "] already started or doesn't exist", this.getClass().getName());
  20. }
  21. }
  22. catch (IOException|TomcatManagerException exception)
  23. {
  24. throw new ContainerException("Failed to start [" + file + "]", exception);
  25. }
  26. }

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

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

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. protected void doStart(JvmLauncher java) throws Exception
  6. {
  7. final File swarmExecutable = new File(getHome());
  8. swarmJvmLauncher.setJarFile(swarmExecutable);
  9. swarmJvmLauncher.setWorkingDirectory(new File(getFileHandler().getAbsolutePath(
  10. getConfiguration().getHome())));
  11. final Configuration configuration = getConfiguration();
  12. String jvmArgs = configuration.getPropertyValue(GeneralPropertySet.JVMARGS);
  13. if (jvmArgs == null || !jvmArgs.contains("-Dswarm.http.port="))
  14. {
  15. swarmJvmLauncher.addJvmArguments("-Dswarm.http.port="
  16. + getConfiguration().getPropertyValue(ServletPropertySet.PORT));
  17. }
  18. WildFlySwarmStandaloneLocalConfiguration wildFlySwarmConfiguration =
  19. (WildFlySwarmStandaloneLocalConfiguration) configuration;
  20. File swarmProjectDescriptor = wildFlySwarmConfiguration.getSwarmProjectDescriptor();
  21. if (swarmProjectDescriptor != null && swarmProjectDescriptor.exists())
  22. {
  23. swarmJvmLauncher.addAppArgumentLine("-s "
  24. + swarmProjectDescriptor.getAbsolutePath());
  25. }
  26. addDeployables();
  27. getLogger().info("Swarm arg line: " + swarmJvmLauncher.getCommandLine(),
  28. getClass().getCanonicalName());
  29. swarmJvmLauncher.start();
  30. }

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

  1. /**
  2. * Create the Cargo logger that will be used for logging all messages. If the user has specified
  3. * a log file we create a File logger. If no file has been specified we use an Ant logger by
  4. * default to log to the Ant logging subsystem.
  5. */
  6. private void createCargoLogger()
  7. {
  8. if (getLog() != null)
  9. {
  10. this.logger = new FileLogger(getLog(), true);
  11. }
  12. else
  13. {
  14. // Use an Ant logger adapter to log to Ant
  15. this.logger = new AntLogger(getProject());
  16. }
  17. if (getLogLevel() != null)
  18. {
  19. this.logger.setLevel(getLogLevel());
  20. }
  21. else
  22. {
  23. this.logger.setLevel(LogLevel.INFO);
  24. }
  25. }

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

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

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

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

相关文章