本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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();
}
示例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());
}
}
示例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());
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
}
示例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("");
}
示例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("");
}
示例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);
}
}
示例14: logErrorStart
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
public static void logErrorStart(Log log) {
log.error("-----------------------------------------------------------------------");
log.error("MAVEN CONFIGURATION ERROR");
}
示例15: logErrorFinish
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
public static void logErrorFinish(Log log) {
log.error("-----------------------------------------------------------------------");
}