Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy load logger in ResultUtils to supress SLF4J warings in AnnotationProcessing #968

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import io.qameta.allure.model.Parameter;
import io.qameta.allure.model.Status;
import io.qameta.allure.model.StatusDetails;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -96,7 +95,9 @@ public final class ResultsUtils {
public static final String FRAMEWORK_LABEL_NAME = "framework";
public static final String LANGUAGE_LABEL_NAME = "language";

private static final Logger LOGGER = LoggerFactory.getLogger(ResultsUtils.class);
// We must not initialize the logger here.
// See: https://github.com/allure-framework/allure-java/issues/962
// private static final Logger LOGGER = LoggerFactory.getLogger(ResultsUtils.class);
private static final String ALLURE_DESCRIPTIONS_FOLDER = "META-INF/allureDescriptions/";
private static final String MD_5 = "MD5";

Expand Down Expand Up @@ -364,7 +365,7 @@ private static String getRealHostName() {
try {
cachedHost = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
LOGGER.debug("Could not get host name", e);
LoggerFactory.getLogger(ResultsUtils.class).debug("Could not get host name", e);
cachedHost = "default";
}
}
Expand Down Expand Up @@ -407,7 +408,7 @@ private static Optional<String> readResource(final ClassLoader classLoader, fina
final byte[] bytes = toBytes(is);
return Optional.of(new String(bytes, StandardCharsets.UTF_8));
} catch (IOException e) {
LOGGER.warn("Unable to process description resource file", e);
LoggerFactory.getLogger(ResultsUtils.class).warn("Unable to process description resource file", e);
}
return Optional.empty();
}
Expand Down
Loading