當前位置: 首頁>>代碼示例>>Java>>正文


Java Log.error方法代碼示例

本文整理匯總了Java中org.apache.maven.plugin.logging.Log.error方法的典型用法代碼示例。如果您正苦於以下問題:Java Log.error方法的具體用法?Java Log.error怎麽用?Java Log.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.maven.plugin.logging.Log的用法示例。


在下文中一共展示了Log.error方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testLog

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public void testLog()
{
    Log log = new DependencySilentLog();
    String text = new String( "Text" );
    Throwable e = new RuntimeException();
    log.debug( text );
    log.debug( text, e );
    log.debug( e );
    log.info( text );
    log.info( text, e );
    log.info( e );
    log.warn( text );
    log.warn( text, e );
    log.warn( e );
    log.error( text );
    log.error( text, e );
    log.error( e );
    log.isDebugEnabled();
    log.isErrorEnabled();
    log.isWarnEnabled();
    log.isInfoEnabled();
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:23,代碼來源:TestSilentLog.java

示例2: getFileResults

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
@Nonnull
private Collection<FileResult> getFileResults(final Log log, final Path dir) {
    Collection<FileResult> allFiles = new ArrayList<>();
    FileVisitor<Path> fileVisitor = new GetEncodingsFileVisitor(
            log,
            this.getIncludeRegex() != null ? this.getIncludeRegex() : INCLUDE_REGEX_DEFAULT,
            this.getExcludeRegex() != null ? this.getExcludeRegex() : EXCLUDE_REGEX_DEFAULT,
            allFiles
    );
    try {
        Set<FileVisitOption> visitOptions = new LinkedHashSet<>();
        visitOptions.add(FileVisitOption.FOLLOW_LINKS);
        Files.walkFileTree(dir,
                visitOptions,
                Integer.MAX_VALUE,
                fileVisitor
        );
    } catch (Exception e) {
        log.error(e.getCause() + e.getMessage());
    }
    return allFiles;
}
 
開發者ID:mikkoi,項目名稱:maven-enforcer-char-set-encoding,代碼行數:23,代碼來源:CharacterSetEncodingRule.java

示例3: requireValuesHaveType

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
static <K, T>
Optional<ImmutableMap<K, T>> requireValuesHaveType(
    Log log, ImmutableMap<K, ?> m, Class<T> valueType, String desc) {
  for (Map.Entry<K, ?> e : m.entrySet()) {
    Object v = e.getValue();
    if (v != null && !valueType.isInstance(v)) {
      log.error("Value " + v + " in " + desc
          + " has type " + v.getClass().getSimpleName()
          + ", not " + valueType.getSimpleName());
      return Optional.absent();
    }
  }
  @SuppressWarnings("unchecked")
  ImmutableMap<K, T> typedMap = (ImmutableMap<K, T>) m;
  return Optional.of(typedMap);
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:17,代碼來源:CssOptions.java

示例4: classForName

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
/**
 * Best effort to look up a class and ensures that it is a sub-type of the
 * given type.
 * <p>
 * Some compilers allow plugging-in customizations by providing an instance
 * of an interface.  One way to bridge the gap between that and string flag
 * values or XML plexus configuration elements is by convention -- provide
 * the name of a public concrete class with a public zero-argument constructor
 * that is a sub-type.
 *
 * @param name a qualified class name available from this class's
 *      class loader.
 * @param superType a super-type of the class to load.
 *
 * @return some class when that class can be loaded and obeys the type
 *      constraints above.
 */
public static <ST>
Optional<Class<? extends ST>> classForName(
    Log log, String name, Class<ST> superType) {
  ClassLoader cll = OptionsUtils.class.getClassLoader();
  Class<?> cl = null;
  try {
    if (cll != null) {
      cl = cll.loadClass(name);
    } else {
      cl = Class.forName(name);
    }
  } catch (ClassNotFoundException ex) {
    log.error("Failed to load class " + name);
    log.error(ex);
  }
  if (cl != null) {
    if (superType.isAssignableFrom(cl)) {
      return Optional.<Class<? extends ST>>of(cl.asSubclass(superType));
    } else {
      log.error("Loaded class " + name + " is not a subtype of " + superType);
    }
  }
  return Optional.absent();
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:42,代碼來源:OptionsUtils.java

示例5: deploy

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
private void deploy(File applicationFile, Log log) throws MojoExecutionException {
    String url = configServerHostname + ":" + configServerPort;
    log.info("Using " + url);
    try {
        InputStream is = new FileInputStream(applicationFile);
        HttpClient client = new HttpClient(configServerHostname, configServerPort, log);
        String response = client.deployApplication(is);
        if (response == null) {
            log.error("Unable to deploy to " + url);
            System.exit(1);
        }
        long sessionId = getSessionIdFromResponse(response);
        client.prepareApplication(sessionId);
        if (activate) {
            client.activateApplication(sessionId);
        }
    } catch (IOException e) {
        throw new MojoExecutionException(e.getMessage());
    }
}
 
開發者ID:vespa-engine,項目名稱:vespa,代碼行數:21,代碼來源:ApplicationDeployMojo.java

示例6: printBigErrorMessageAndThrow

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public void printBigErrorMessageAndThrow(final Log log) throws MojoExecutionException {
	log.error("");
	log.error("");
	log.error("");
	log.error("************************************");
	log.error("Could not execute the release plugin");
	log.error("************************************");
	log.error("");
	log.error("");
	log.error(getMessage());
	for (final String line : messages) {
		log.error(line);
	}
	log.error("");
	log.error("");
	printCause(log);
	throw new MojoExecutionException(getMessage());
}
 
開發者ID:SourcePond,項目名稱:release-maven-plugin-parent,代碼行數:19,代碼來源:PluginException.java

示例7: connect

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
/**
 * @param url
 * @param parameters
 * @param log
 * @return
 * @throws MojoExecutionException
 */
public Map<String, String> connect( String url, Map<String, Object> parameters, Log log )
    throws MojoExecutionException
{

    Map<String, String> response = new HashMap<String, String>();
    CloseableHttpClient httpclient = HttpClients.createDefault();
    List<NameValuePair> nvps = new ArrayList<>();
    nvps.add( new BasicNameValuePair( "j_username", (String) parameters.get( "login" ) ) );
    nvps.add( new BasicNameValuePair( "j_password", (String) parameters.get( "password" ) ) );
    localContext = HttpClientContext.create();
    localContext.setCookieStore( new BasicCookieStore() );
    HttpPost httpPost = new HttpPost( url );

    try
    {
        httpPost.setEntity( new UrlEncodedFormEntity( nvps ) );
        CloseableHttpResponse httpResponse = httpclient.execute( httpPost, localContext );
        ResponseHandler<String> handler = new ResponseErrorHandler();
        String body = handler.handleResponse( httpResponse );
        response.put( "body", body );
        httpResponse.close();
        isConnected = true;
        log.info( "Connection successful" );
    }
    catch ( Exception e )
    {
        log.error( "Connection failed!  : " + e.getMessage() );
        isConnected = false;
        throw new MojoExecutionException(
                                          "Connection failed, please check your manager location or your credentials" );
    }

    return response;
}
 
開發者ID:oncecloud,項目名稱:devops-cstack,代碼行數:42,代碼來源:RestUtils.java

示例8: execute

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public int execute(@Nullable String customCommand, @Nonnull final Log logger, @Nonnull final File cvsFolder, @Nonnull @MustNotContainNull final String... args) {
    final List<String> cli = new ArrayList<>();
    cli.add(GetUtils.findFirstNonNull(customCommand, this.command));
    for (final String s : args) {
        cli.add(s);
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Executing repo command : " + cli);
    }

    final ByteArrayOutputStream errorStream = new ByteArrayOutputStream();
    final ByteArrayOutputStream outStream = new ByteArrayOutputStream();

    final ProcessExecutor executor = new ProcessExecutor(cli);

    int result = -1;

    try {
        final ProcessResult processResult = executor.directory(cvsFolder).redirectError(errorStream).redirectOutput(outStream).executeNoTimeout();
        result = processResult.getExitValue();

        if (logger.isDebugEnabled()) {
            logger.debug("Exec.out.........................................");
            logger.debug(new String(errorStream.toByteArray(), Charset.defaultCharset()));
            logger.debug(".................................................");
        }

        if (result != 0) {
            logger.error(new String(errorStream.toByteArray(), Charset.defaultCharset()));
        }

    } catch (Exception ex) {
        logger.error("Unexpected error", ex);
    }

    return result;
}
 
開發者ID:raydac,項目名稱:mvn-golang,代碼行數:39,代碼來源:AbstractRepo.java

示例9: keyValueMapFromJson

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
/**
 * Best effort to derive a string to primitive value map from a string of JSON
 * text.
 */
public static Optional<ImmutableMap<String, Object>> keyValueMapFromJson(
    Log log, String json) {
  ImmutableMap.Builder<String, Object> b = ImmutableMap.builder();
  JSONParser p = new JSONParser();
  Object result;
  try {
    result = p.parse(json);
  } catch (ParseException ex) {
    log.error("Invalid json: " + json);
    log.error(ex);
    return Optional.absent();
  }
  if (result instanceof Map<?, ?>) {
    for (Map.Entry<?, ?> e : ((Map<?, ?>) result).entrySet()) {
      Object k = e.getKey();
      Object v = e.getValue();
      if (!(k instanceof String)) {
        log.error("Bad key " + k + " : " + (k != null ? k.getClass() : null));
        continue;
      }
      if (!(v instanceof Boolean
            || v instanceof Number
            || v instanceof String
            || v == null)) {
        log.error("Value for key " + k + " is not simple : "
            + v + " : " + v.getClass());
        continue;
      }
      b.put((String) k, v);  // TODO: not robust against duplicate keys
    }
  }
  return Optional.of(b.build());
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:38,代碼來源:OptionsUtils.java

示例10: logErrorBaseProblem

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public static void logErrorBaseProblem(Log log, String[] messages) {
    log.error("");
    log.error("\tBASE PROBLEM:");
    for (String message : messages)
    {
        log.error("\t" + message);
    }
}
 
開發者ID:bretthshelley,項目名稱:Maven-IIB9-Plug-In,代碼行數:9,代碼來源:AbstractValidator.java

示例11: logErrorInstructions

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public static void logErrorInstructions(Log log, String[] messages) {
    log.error("");
    log.error("\tINSTRUCTIONS:");
    for (String message : messages)
    {
        log.error("\t" + message);
    }
    log.error("");
}
 
開發者ID:bretthshelley,項目名稱:Maven-IIB9-Plug-In,代碼行數:10,代碼來源:AbstractValidator.java

示例12: logErrorExample

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public static void logErrorExample(Log log, String[] messages) {
    log.error("");
    log.error("\tEXAMPLE:");
    for (String message : messages)
    {
        log.error("\t" + message);
    }
    log.error("");
}
 
開發者ID:bretthshelley,項目名稱:Maven-IIB9-Plug-In,代碼行數:10,代碼來源:AbstractValidator.java

示例13: printCause

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
private void printCause(final Log log) {
	if (getCause() != null) {
		log.error(format("Caused by %s", getCause().getClass()));
		log.error(getCause().getMessage());
	}

	if (getCause() instanceof PluginException) {
		final PluginException plex = (PluginException) getCause();
		for (final String line : plex.messages) {
			log.error(line);
		}
		log.error("");
		plex.printCause(log);
	}
}
 
開發者ID:SourcePond,項目名稱:release-maven-plugin-parent,代碼行數:16,代碼來源:PluginException.java

示例14: logErrorStart

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public static void logErrorStart(Log log) {
    log.error("-----------------------------------------------------------------------");
    log.error("MAVEN CONFIGURATION ERROR");
}
 
開發者ID:bretthshelley,項目名稱:Maven-IIB9-Plug-In,代碼行數:5,代碼來源:AbstractValidator.java

示例15: logErrorFinish

import org.apache.maven.plugin.logging.Log; //導入方法依賴的package包/類
public static void logErrorFinish(Log log) {
    log.error("-----------------------------------------------------------------------");
}
 
開發者ID:bretthshelley,項目名稱:Maven-IIB9-Plug-In,代碼行數:4,代碼來源:AbstractValidator.java


注:本文中的org.apache.maven.plugin.logging.Log.error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。