Testing logging with slf4j version 1.8 or higher
I wanted to update my slf4j-api dependencies to 1.8.0-beta2, but with this version I am no longer able to use uk.org.lidalia:slf4j-test:1.2.0 for testing logging, because of the following error:
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.
SLF4J: Ignoring binding found at [jar:file:/C:/Users/OEM/.m2/repository/uk/org/lidalia/slf4j-test/1.2.0/slf4j-test-1.2.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation.
I found in the documentation this is because:
Planning for the advent of Jigsaw (Java 9), slf4j-api version 1.8.x and later use the ServiceLoader mechanism. Earlier versions of SLF4J relied on the static binder mechanism which is no longer honored by slf4j-api.
In case SLF4J finds no providers targeting SLF4J 1.8 but finds instead bindings targeting SLF4J 1.7 or earlier, it will list the bindings it finds but otherwise ignores them.
What optionsdo I have for slf4j logging testing? uk.org.lidalia:slf4j-test:1.2.0 is the latest version and has not been updated since 2015.
slf4j
add a comment |
I wanted to update my slf4j-api dependencies to 1.8.0-beta2, but with this version I am no longer able to use uk.org.lidalia:slf4j-test:1.2.0 for testing logging, because of the following error:
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.
SLF4J: Ignoring binding found at [jar:file:/C:/Users/OEM/.m2/repository/uk/org/lidalia/slf4j-test/1.2.0/slf4j-test-1.2.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation.
I found in the documentation this is because:
Planning for the advent of Jigsaw (Java 9), slf4j-api version 1.8.x and later use the ServiceLoader mechanism. Earlier versions of SLF4J relied on the static binder mechanism which is no longer honored by slf4j-api.
In case SLF4J finds no providers targeting SLF4J 1.8 but finds instead bindings targeting SLF4J 1.7 or earlier, it will list the bindings it finds but otherwise ignores them.
What optionsdo I have for slf4j logging testing? uk.org.lidalia:slf4j-test:1.2.0 is the latest version and has not been updated since 2015.
slf4j
add a comment |
I wanted to update my slf4j-api dependencies to 1.8.0-beta2, but with this version I am no longer able to use uk.org.lidalia:slf4j-test:1.2.0 for testing logging, because of the following error:
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.
SLF4J: Ignoring binding found at [jar:file:/C:/Users/OEM/.m2/repository/uk/org/lidalia/slf4j-test/1.2.0/slf4j-test-1.2.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation.
I found in the documentation this is because:
Planning for the advent of Jigsaw (Java 9), slf4j-api version 1.8.x and later use the ServiceLoader mechanism. Earlier versions of SLF4J relied on the static binder mechanism which is no longer honored by slf4j-api.
In case SLF4J finds no providers targeting SLF4J 1.8 but finds instead bindings targeting SLF4J 1.7 or earlier, it will list the bindings it finds but otherwise ignores them.
What optionsdo I have for slf4j logging testing? uk.org.lidalia:slf4j-test:1.2.0 is the latest version and has not been updated since 2015.
slf4j
I wanted to update my slf4j-api dependencies to 1.8.0-beta2, but with this version I am no longer able to use uk.org.lidalia:slf4j-test:1.2.0 for testing logging, because of the following error:
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.
SLF4J: Ignoring binding found at [jar:file:/C:/Users/OEM/.m2/repository/uk/org/lidalia/slf4j-test/1.2.0/slf4j-test-1.2.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation.
I found in the documentation this is because:
Planning for the advent of Jigsaw (Java 9), slf4j-api version 1.8.x and later use the ServiceLoader mechanism. Earlier versions of SLF4J relied on the static binder mechanism which is no longer honored by slf4j-api.
In case SLF4J finds no providers targeting SLF4J 1.8 but finds instead bindings targeting SLF4J 1.7 or earlier, it will list the bindings it finds but otherwise ignores them.
What optionsdo I have for slf4j logging testing? uk.org.lidalia:slf4j-test:1.2.0 is the latest version and has not been updated since 2015.
slf4j
slf4j
asked Jan 1 at 23:44
dziecioudzieciou
99321441
99321441
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Maybe one way is to set logback-classic as a dependency with a 'test' scope (here using Maven):
<!-- Logging during tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
<version>LATEST</version>
</dependency>
and test logging according to instructions in this other post:
https://stackoverflow.com/a/29077499/10881066
Also, have you seen spf4j-slf4j-test? This looks like what you are looking for. The latest version does not yet support slf4j 1.8 but the project seems to be actively maintained.
Support for Slf4j 1.8 may be added in a near future?
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53999814%2ftesting-logging-with-slf4j-version-1-8-or-higher%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Maybe one way is to set logback-classic as a dependency with a 'test' scope (here using Maven):
<!-- Logging during tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
<version>LATEST</version>
</dependency>
and test logging according to instructions in this other post:
https://stackoverflow.com/a/29077499/10881066
Also, have you seen spf4j-slf4j-test? This looks like what you are looking for. The latest version does not yet support slf4j 1.8 but the project seems to be actively maintained.
Support for Slf4j 1.8 may be added in a near future?
add a comment |
Maybe one way is to set logback-classic as a dependency with a 'test' scope (here using Maven):
<!-- Logging during tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
<version>LATEST</version>
</dependency>
and test logging according to instructions in this other post:
https://stackoverflow.com/a/29077499/10881066
Also, have you seen spf4j-slf4j-test? This looks like what you are looking for. The latest version does not yet support slf4j 1.8 but the project seems to be actively maintained.
Support for Slf4j 1.8 may be added in a near future?
add a comment |
Maybe one way is to set logback-classic as a dependency with a 'test' scope (here using Maven):
<!-- Logging during tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
<version>LATEST</version>
</dependency>
and test logging according to instructions in this other post:
https://stackoverflow.com/a/29077499/10881066
Also, have you seen spf4j-slf4j-test? This looks like what you are looking for. The latest version does not yet support slf4j 1.8 but the project seems to be actively maintained.
Support for Slf4j 1.8 may be added in a near future?
Maybe one way is to set logback-classic as a dependency with a 'test' scope (here using Maven):
<!-- Logging during tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
<version>LATEST</version>
</dependency>
and test logging according to instructions in this other post:
https://stackoverflow.com/a/29077499/10881066
Also, have you seen spf4j-slf4j-test? This looks like what you are looking for. The latest version does not yet support slf4j 1.8 but the project seems to be actively maintained.
Support for Slf4j 1.8 may be added in a near future?
answered Jan 7 at 20:47
GhiommGhiomm
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53999814%2ftesting-logging-with-slf4j-version-1-8-or-higher%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown