Example usage for org.apache.maven.plugin.logging Log isInfoEnabled

List of usage examples for org.apache.maven.plugin.logging Log isInfoEnabled

Introduction

In this page you can find the example usage for org.apache.maven.plugin.logging Log isInfoEnabled.

Prototype

boolean isInfoEnabled();

Source Link

Usage

From source file:com.redhat.rcm.maven.plugin.buildmetadata.AbstractReportMojo.java

License:Apache License

/**
 * Runs the report generation./*from w  w w .java 2s  .c o  m*/
 *
 * @throws MojoExecutionException on any problem encountered.
 */
@Override
public void execute() throws MojoExecutionException // CHECKSTYLE:ON
{
    final Log log = getLog();
    if (!canGenerateReport()) {
        if (log.isInfoEnabled()) {
            log.info("Report '" + getName(Locale.getDefault()) + "' skipped due to offline mode.");
        }
        return;
    }
    getLog();
    provideSink();
}

From source file:com.redhat.rcm.maven.plugin.buildmetadata.AbstractReportMojo.java

License:Apache License

/**
 * {@inheritDoc}//from   w ww  . j av a  2s . c om
 * <p>
 * Configures the plugin logger.
 * </p>
 *
 * @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
 */
@Override
protected void executeReport(final Locale locale) throws MavenReportException // CHECKSTYLE:ON
{
    final Log log = getLog();
    if (!canGenerateReport()) {
        if (log.isInfoEnabled()) {
            log.info("Report '" + getName(Locale.getDefault()) + "' skipped due to offline mode.");
        }
        return;
    }
}

From source file:com.sri.vt.majic.util.clean.Cleaner.java

License:Apache License

/**
 * Creates a new cleaner.//w ww.j ava2  s .  c  o  m
 * 
 * @param log The logger to use, may be <code>null</code> to disable logging.
 * @param verbose Whether to perform verbose logging.
 */
public Cleaner(final Log log, boolean verbose) {
    logDebug = (log == null || !log.isDebugEnabled()) ? null : new Logger() {
        public void log(CharSequence message) {
            log.debug(message);
        }
    };

    logInfo = (log == null || !log.isInfoEnabled()) ? null : new Logger() {
        public void log(CharSequence message) {
            log.info(message);
        }
    };

    logWarn = (log == null || !log.isWarnEnabled()) ? null : new Logger() {
        public void log(CharSequence message) {
            log.warn(message);
        }
    };

    logVerbose = verbose ? logInfo : logDebug;
}

From source file:de.eacg.ecs.plugin.ScanAndTransferMojo.java

private void printStats(Set<Map.Entry<String, SortedSet<MavenProject>>> licenseAndProjectSet,
        Set<Map.Entry<MavenProject, String[]>> projectsAndLicenseSet) {

    Log log = getLog();
    if (log.isInfoEnabled() && this.verbose) {
        log.info("Dependencies found:");
        for (Map.Entry<MavenProject, String[]> entry : projectsAndLicenseSet) {
            MavenProject project = entry.getKey();
            String[] licenses = entry.getValue();
            log.info(String.format("%s %s, %s", project.getId(), project.getName(), Arrays.toString(licenses)));
        }/*from ww  w.  jav  a2s  .  c  om*/
    }
    if (log.isInfoEnabled()) {
        log.info("Licenses found:");
        for (Map.Entry<String, SortedSet<MavenProject>> entry : licenseAndProjectSet) {
            log.info(String.format("%-75s %d", entry.getKey(), entry.getValue().size()));
        }
    }
}

From source file:de.smartics.maven.alias.AbstractReportMojo.java

License:Apache License

/**
 * Runs the report generation.//ww w.j  a  va2  s .  c om
 *
 * @throws MojoExecutionException on any problem encountered.
 */
public void execute() throws MojoExecutionException {
    final Log log = getLog();
    if (!canGenerateReport()) {
        if (log.isInfoEnabled()) {
            log.info("Report '" + getName(Locale.getDefault()) + "' skipped due to offline mode.");
        }
        return;
    }

    provideSink();
}

From source file:de.zalando.mojo.aspectj.MavenMessageHandler.java

License:Open Source License

/**
 * Constructs a MessageHandler with a Maven plugin logger.
 *
 * @param log                           The active Maven Log.
 * @param showDetailsForMessageKindList A List holding all AJC message types for which this MavenMessageHandler
 *                                      should emit details onto the Maven log (i.e. class name,
 *                                      line/row number etc.)
 *//* w  ww. j av a  2 s. co  m*/
public MavenMessageHandler(final Log log, final List<IMessage.Kind> showDetailsForMessageKindList) {

    // Check sanity
    // assert log != null : "Cannot handle null log argument.";
    // assert showDetailsForMessageKindList != null : "Cannot handle null showDetailsForMessageKindList argument.";
    if (log == null) {
        throw new NullPointerException("Cannot handle null log argument.");
    }
    if (showDetailsForMessageKindList == null) {
        throw new NullPointerException("Cannot handle null showDetailsForMessageKindList argument.");
    }

    // Assign internal state
    this.log = log;
    this.showDetailsForMessageKindList = showDetailsForMessageKindList;

    if (log.isInfoEnabled()) {
        log.info("Showing AJC message detail for messages of types: " + showDetailsForMessageKindList);
    }
}

From source file:org.acmsl.queryj.tools.maven.CommonsLoggingMavenLogAdapter.java

License:Open Source License

/**
 * Checks whether the debug level is enabled.
 * @param mavenLog the underlying {@link Log}.
 * @return {@code true} in such case./*from   w  w  w .  ja  va  2 s  . c o m*/
 */
protected boolean isInfoEnabled(@NotNull final Log mavenLog) {
    return mavenLog.isInfoEnabled();
}

From source file:org.apache.pluto.maven.AssembleMojo.java

License:Apache License

protected void doExecute() throws MojoExecutionException {

    // Log parameter values.
    Log log = getLog();
    if (log.isInfoEnabled()) {
        if (archives == null || archives.isEmpty()) {
            log.info("Reading web.xml from :" + webXml.getAbsolutePath());
            log.info("Reading portlet.xml from: " + portletXml.getAbsolutePath());
            log.info("Writing web.xml to: " + webXmlDestination.getAbsolutePath());
        }/*from   w  w  w. j av a2s  .  co m*/
    }

    try {
        // Assemble portlet app by updating web.xml.
        if (archives == null || archives.isEmpty()) {
            AssemblerConfig config = createAssemblerConfig();
            Assembler assembler = AssemblerFactory.getFactory().createAssembler(config);
            assembler.assemble(config);
        } else {
            for (Iterator i = archives.iterator(); i.hasNext();) {
                File archive = new File(i.next().toString());
                if (log.isInfoEnabled()) {
                    log.info("Assembling archive file " + archive.getAbsolutePath() + " to directory "
                            + assemblyOutputDirectory.getAbsolutePath());
                }
                AssemblerConfig config = createArchiveAssemblerConfig(archive, assemblyOutputDirectory);
                Assembler assembler = AssemblerFactory.getFactory().createAssembler(config);
                assembler.assemble(config);
            }
        }
    } catch (UtilityException e) {
        log.error("Assembly failed: " + e.getMessage(), e);
    }
}

From source file:org.codehaus.mojo.apt.LogUtils.java

License:Open Source License

public static boolean isEnabled(Log log, int level) {
    boolean enabled;

    if (level == LEVEL_DEBUG) {
        enabled = log.isDebugEnabled();/*  w ww  .  ja v a  2 s.  c o  m*/
    } else if (level == LEVEL_INFO) {
        enabled = log.isInfoEnabled();
    } else if (level == LEVEL_WARN) {
        enabled = log.isWarnEnabled();
    } else if (level == LEVEL_ERROR) {
        enabled = log.isErrorEnabled();
    } else {
        throw new IllegalArgumentException("Unknown log level: " + level);
    }

    return enabled;
}

From source file:org.codehaus.mojo.cobertura.integration.LogLevel.java

License:Apache License

/**
 * Simple conversion method extracting the LogLevel matching the level
 * assigned to the supplied Log./*from   w  w  w .  ja  va2 s .c o  m*/
 *
 * @param mavenLog The non-null Log instance.
 * @return The LogLevel matching the existing level of the supplied mavenLog.
 */
public static LogLevel getMatchingLevel(final Log mavenLog) {

    // Check sanity
    Validate.notNull(mavenLog, "Cannot handle null mavenLog argument.");

    LogLevel toReturn;
    if (mavenLog.isDebugEnabled()) {
        toReturn = LogLevel.DEBUG;
    } else if (mavenLog.isInfoEnabled()) {
        toReturn = LogLevel.INFO;
    } else if (mavenLog.isWarnEnabled()) {
        toReturn = LogLevel.WARNING;
    } else {
        toReturn = LogLevel.ERROR;
    }

    // All done.
    return toReturn;
}