Java Code Examples for org.gradle.api.logging.LogLevel#DEBUG

The following examples show how to use org.gradle.api.logging.LogLevel#DEBUG . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogLevelConverter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Maps a Logback log level and optional marker to a Gradle log level.
 * Returns null if there is no equivalent Gradle log level (such as for TRACE).
 */
@Nullable
public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) {
    switch(level.toInt()) {
        case Level.TRACE_INT:
            return null;
        case Level.DEBUG_INT:
            return LogLevel.DEBUG;
        case Level.INFO_INT:
            if (marker == Logging.LIFECYCLE) {
                return LogLevel.LIFECYCLE;
            }
            if (marker == Logging.QUIET) {
                return LogLevel.QUIET;
            }
            return LogLevel.INFO;
        case Level.WARN_INT:
            return LogLevel.WARN;
        case Level.ERROR_INT:
            return LogLevel.ERROR;
        default:
            throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level");
    }
}
 
Example 2
Source File: StyledTextOutputBackedRenderer.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void onOutput(OutputEvent event) {
    if (event instanceof LogLevelChangeEvent) {
        LogLevelChangeEvent changeEvent = (LogLevelChangeEvent) event;
        debugOutput = changeEvent.getNewLogLevel() == LogLevel.DEBUG;
    }
    if (event instanceof RenderableOutputEvent) {
        RenderableOutputEvent outputEvent = (RenderableOutputEvent) event;
        textOutput.style(outputEvent.getLogLevel() == LogLevel.ERROR ? Error : Normal);
        if (debugOutput && (textOutput.atEndOfLine || lastEvent == null || !lastEvent.getCategory().equals(outputEvent.getCategory()))) {
            if (!textOutput.atEndOfLine) {
                textOutput.println();
            }
            textOutput.text(new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(outputEvent.getTimestamp())));
            textOutput.text(" [");
            textOutput.text(outputEvent.getLogLevel());
            textOutput.text("] [");
            textOutput.text(outputEvent.getCategory());
            textOutput.text("] ");
        }
        outputEvent.render(textOutput);
        lastEvent = outputEvent;
        textOutput.style(Normal);
    }
}
 
Example 3
Source File: BuildExceptionReporter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void fillInFailureResolution(FailureDetails details) {
    if (details.failure instanceof FailureResolutionAware) {
        ((FailureResolutionAware) details.failure).appendResolution(details.resolution, clientMetaData);
        if (details.resolution.getHasContent()) {
            details.resolution.append(' ');
        }
    }
    if (details.exceptionStyle == ExceptionStyle.NONE) {
        details.resolution.text("Run with ");
        details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.STACKTRACE_LONG);
        details.resolution.text(" option to get the stack trace. ");
    }
    if (loggingConfiguration.getLogLevel() != LogLevel.DEBUG) {
        details.resolution.text("Run with ");
        if (loggingConfiguration.getLogLevel() != LogLevel.INFO) {
            details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.INFO_LONG);
            details.resolution.text(" or ");
        }
        details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.DEBUG_LONG);
        details.resolution.text(" option to get more log output.");
    }
}
 
Example 4
Source File: LogLevelConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Maps a Logback log level and optional marker to a Gradle log level.
 * Returns null if there is no equivalent Gradle log level (such as for TRACE).
 */
@Nullable
public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) {
    switch(level.toInt()) {
        case Level.TRACE_INT:
            return null;
        case Level.DEBUG_INT:
            return LogLevel.DEBUG;
        case Level.INFO_INT:
            if (marker == Logging.LIFECYCLE) {
                return LogLevel.LIFECYCLE;
            }
            if (marker == Logging.QUIET) {
                return LogLevel.QUIET;
            }
            return LogLevel.INFO;
        case Level.WARN_INT:
            return LogLevel.WARN;
        case Level.ERROR_INT:
            return LogLevel.ERROR;
        default:
            throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level");
    }
}
 
Example 5
Source File: StyledTextOutputBackedRenderer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void onOutput(OutputEvent event) {
    if (event instanceof LogLevelChangeEvent) {
        LogLevelChangeEvent changeEvent = (LogLevelChangeEvent) event;
        debugOutput = changeEvent.getNewLogLevel() == LogLevel.DEBUG;
    }
    if (event instanceof RenderableOutputEvent) {
        RenderableOutputEvent outputEvent = (RenderableOutputEvent) event;
        textOutput.style(outputEvent.getLogLevel() == LogLevel.ERROR ? Error : Normal);
        if (debugOutput && (textOutput.atEndOfLine || lastEvent == null || !lastEvent.getCategory().equals(outputEvent.getCategory()))) {
            if (!textOutput.atEndOfLine) {
                textOutput.println();
            }
            textOutput.text(new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(outputEvent.getTimestamp())));
            textOutput.text(" [");
            textOutput.text(outputEvent.getLogLevel());
            textOutput.text("] [");
            textOutput.text(outputEvent.getCategory());
            textOutput.text("] ");
        }
        outputEvent.render(textOutput);
        lastEvent = outputEvent;
        textOutput.style(Normal);
    }
}
 
Example 6
Source File: BuildExceptionReporter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void fillInFailureResolution(FailureDetails details) {
    if (details.failure instanceof FailureResolutionAware) {
        ((FailureResolutionAware) details.failure).appendResolution(details.resolution, clientMetaData);
        if (details.resolution.getHasContent()) {
            details.resolution.append(' ');
        }
    }
    if (details.exceptionStyle == ExceptionStyle.NONE) {
        details.resolution.text("Run with ");
        details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.STACKTRACE_LONG);
        details.resolution.text(" option to get the stack trace. ");
    }
    if (loggingConfiguration.getLogLevel() != LogLevel.DEBUG) {
        details.resolution.text("Run with ");
        if (loggingConfiguration.getLogLevel() != LogLevel.INFO) {
            details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.INFO_LONG);
            details.resolution.text(" or ");
        }
        details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.DEBUG_LONG);
        details.resolution.text(" option to get more log output.");
    }
}
 
Example 7
Source File: BuildExceptionReporter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void fillInFailureResolution(FailureDetails details) {
    if (details.failure instanceof FailureResolutionAware) {
        ((FailureResolutionAware) details.failure).appendResolution(details.resolution, clientMetaData);
        if (details.resolution.getHasContent()) {
            details.resolution.append(' ');
        }
    }
    if (details.exceptionStyle == ExceptionStyle.NONE) {
        details.resolution.text("Run with ");
        details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.STACKTRACE_LONG);
        details.resolution.text(" option to get the stack trace. ");
    }
    if (loggingConfiguration.getLogLevel() != LogLevel.DEBUG) {
        details.resolution.text("Run with ");
        if (loggingConfiguration.getLogLevel() != LogLevel.INFO) {
            details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.INFO_LONG);
            details.resolution.text(" or ");
        }
        details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.DEBUG_LONG);
        details.resolution.text(" option to get more log output.");
    }
}
 
Example 8
Source File: StyledTextOutputBackedRenderer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void onOutput(OutputEvent event) {
    if (event instanceof LogLevelChangeEvent) {
        LogLevelChangeEvent changeEvent = (LogLevelChangeEvent) event;
        debugOutput = changeEvent.getNewLogLevel() == LogLevel.DEBUG;
    }
    if (event instanceof RenderableOutputEvent) {
        RenderableOutputEvent outputEvent = (RenderableOutputEvent) event;
        textOutput.style(outputEvent.getLogLevel() == LogLevel.ERROR ? Error : Normal);
        if (debugOutput && (textOutput.atEndOfLine || lastEvent == null || !lastEvent.getCategory().equals(outputEvent.getCategory()))) {
            if (!textOutput.atEndOfLine) {
                textOutput.println();
            }
            textOutput.text(new SimpleDateFormat("HH:mm:ss.SSS").format(new Date(outputEvent.getTimestamp())));
            textOutput.text(" [");
            textOutput.text(outputEvent.getLogLevel());
            textOutput.text("] [");
            textOutput.text(outputEvent.getCategory());
            textOutput.text("] ");
        }
        outputEvent.render(textOutput);
        lastEvent = outputEvent;
        textOutput.style(Normal);
    }
}
 
Example 9
Source File: BuildExceptionReporter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void fillInFailureResolution(FailureDetails details) {
    if (details.failure instanceof FailureResolutionAware) {
        ((FailureResolutionAware) details.failure).appendResolution(details.resolution, clientMetaData);
        if (details.resolution.getHasContent()) {
            details.resolution.append(' ');
        }
    }
    if (details.exceptionStyle == ExceptionStyle.NONE) {
        details.resolution.text("Run with ");
        details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.STACKTRACE_LONG);
        details.resolution.text(" option to get the stack trace. ");
    }
    if (loggingConfiguration.getLogLevel() != LogLevel.DEBUG) {
        details.resolution.text("Run with ");
        if (loggingConfiguration.getLogLevel() != LogLevel.INFO) {
            details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.INFO_LONG);
            details.resolution.text(" or ");
        }
        details.resolution.withStyle(UserInput).format("--%s", LoggingCommandLineConverter.DEBUG_LONG);
        details.resolution.text(" option to get more log output.");
    }
}
 
Example 10
Source File: LogLevelConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Maps a Logback log level and optional marker to a Gradle log level.
 * Returns null if there is no equivalent Gradle log level (such as for TRACE).
 */
@Nullable
public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) {
    switch(level.toInt()) {
        case Level.TRACE_INT:
            return null;
        case Level.DEBUG_INT:
            return LogLevel.DEBUG;
        case Level.INFO_INT:
            if (marker == Logging.LIFECYCLE) {
                return LogLevel.LIFECYCLE;
            }
            if (marker == Logging.QUIET) {
                return LogLevel.QUIET;
            }
            return LogLevel.INFO;
        case Level.WARN_INT:
            return LogLevel.WARN;
        case Level.ERROR_INT:
            return LogLevel.ERROR;
        default:
            throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level");
    }
}
 
Example 11
Source File: BuildExceptionReporter.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void reportBuildFailure(String granularity, Throwable failure, FailureDetails details) {
    if (loggingConfiguration.getShowStacktrace() == ShowStacktrace.ALWAYS || loggingConfiguration.getLogLevel() == LogLevel.DEBUG) {
        details.exceptionStyle = ExceptionStyle.SANITIZED;
    }
    if (loggingConfiguration.getShowStacktrace() == ShowStacktrace.ALWAYS_FULL) {
        details.exceptionStyle = ExceptionStyle.FULL;
    }

    formatGenericFailure(granularity, failure, details);
}
 
Example 12
Source File: GradleRunnerInteractionWrapper.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * @return the log level. This determines the detail level of information reported via reportLiveOutput and reportExecutionFinished.
 */
public LogLevel getLogLevel() {
    GradleRunnerInteractionVersion1.LogLevel logLevel = interactionVersion1.getLogLevel();
    switch (logLevel) {
        case Quiet:
            return LogLevel.QUIET;
        case Lifecycle:
            return LogLevel.LIFECYCLE;
        case Debug:
            return LogLevel.DEBUG;
    }

    return LogLevel.LIFECYCLE;
}
 
Example 13
Source File: ProviderConnection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(ProviderConnectionParameters parameters) {
    LogLevel providerLogLevel = parameters.getVerboseLogging() ? LogLevel.DEBUG : LogLevel.INFO;
    LOGGER.debug("Configuring logging to level: {}", providerLogLevel);
    LoggingManagerInternal loggingManager = loggingServices.newInstance(LoggingManagerInternal.class);
    loggingManager.setLevel(providerLogLevel);
    loggingManager.start();
}
 
Example 14
Source File: ProviderConnection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(ProviderConnectionParameters parameters) {
    LogLevel providerLogLevel = parameters.getVerboseLogging() ? LogLevel.DEBUG : LogLevel.INFO;
    LOGGER.debug("Configuring logging to level: {}", providerLogLevel);
    LoggingManagerInternal loggingManager = loggingServices.newInstance(LoggingManagerInternal.class);
    loggingManager.setLevel(providerLogLevel);
    loggingManager.start();
}
 
Example 15
Source File: BuildLogLevelMixIn.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public LogLevel getBuildLogLevel() {
    LoggingCommandLineConverter converter = new LoggingCommandLineConverter();
    CommandLineParser parser = new CommandLineParser().allowUnknownOptions().allowMixedSubcommandsAndOptions();
    converter.configure(parser);
    ParsedCommandLine parsedCommandLine = parser.parse(parameters.getArguments(Collections.<String>emptyList()));
    //configure verbosely only if arguments do not specify any log level.
    if (parameters.getVerboseLogging(false) && !parsedCommandLine.hasAnyOption(converter.getLogLevelOptions())) {
        return LogLevel.DEBUG;
    }

    LoggingConfiguration loggingConfiguration = converter.convert(parsedCommandLine, new LoggingConfiguration());
    return loggingConfiguration.getLogLevel();
}
 
Example 16
Source File: BuildLogLevelMixIn.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public LogLevel getBuildLogLevel() {
    LoggingCommandLineConverter converter = new LoggingCommandLineConverter();
    CommandLineParser parser = new CommandLineParser().allowUnknownOptions().allowMixedSubcommandsAndOptions();
    converter.configure(parser);
    ParsedCommandLine parsedCommandLine = parser.parse(parameters.getArguments(Collections.<String>emptyList()));
    //configure verbosely only if arguments do not specify any log level.
    if (parameters.getVerboseLogging(false) && !parsedCommandLine.hasAnyOption(converter.getLogLevelOptions())) {
        return LogLevel.DEBUG;
    }

    LoggingConfiguration loggingConfiguration = converter.convert(parsedCommandLine, new LoggingConfiguration());
    return loggingConfiguration.getLogLevel();
}
 
Example 17
Source File: BuildExceptionReporter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void reportBuildFailure(String granularity, Throwable failure, FailureDetails details) {
    if (loggingConfiguration.getShowStacktrace() == ShowStacktrace.ALWAYS || loggingConfiguration.getLogLevel() == LogLevel.DEBUG) {
        details.exceptionStyle = ExceptionStyle.SANITIZED;
    }
    if (loggingConfiguration.getShowStacktrace() == ShowStacktrace.ALWAYS_FULL) {
        details.exceptionStyle = ExceptionStyle.FULL;
    }

    formatGenericFailure(granularity, failure, details);
}
 
Example 18
Source File: ProviderConnection.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(ProviderConnectionParameters parameters) {
    LogLevel providerLogLevel = parameters.getVerboseLogging() ? LogLevel.DEBUG : LogLevel.INFO;
    LOGGER.debug("Configuring logging to level: {}", providerLogLevel);
    LoggingManagerInternal loggingManager = loggingServices.newInstance(LoggingManagerInternal.class);
    loggingManager.setLevel(providerLogLevel);
    loggingManager.start();
}
 
Example 19
Source File: BuildLogLevelMixIn.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public LogLevel getBuildLogLevel() {
    LoggingCommandLineConverter converter = new LoggingCommandLineConverter();
    CommandLineParser parser = new CommandLineParser().allowUnknownOptions().allowMixedSubcommandsAndOptions();
    converter.configure(parser);
    ParsedCommandLine parsedCommandLine = parser.parse(parameters.getArguments(Collections.<String>emptyList()));
    //configure verbosely only if arguments do not specify any log level.
    if (parameters.getVerboseLogging(false) && !parsedCommandLine.hasAnyOption(converter.getLogLevelOptions())) {
        return LogLevel.DEBUG;
    }

    LoggingConfiguration loggingConfiguration = converter.convert(parsedCommandLine);
    return loggingConfiguration.getLogLevel();
}
 
Example 20
Source File: ProviderConnection.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(ProviderConnectionParameters parameters) {
    LogLevel providerLogLevel = parameters.getVerboseLogging() ? LogLevel.DEBUG : LogLevel.INFO;
    LOGGER.debug("Configuring logging to level: {}", providerLogLevel);
    LoggingManagerInternal loggingManager = loggingServices.newInstance(LoggingManagerInternal.class);
    loggingManager.setLevel(providerLogLevel);
    loggingManager.start();
}