I use eclipse 4.31 with slf4j.api 2.0.13 and ch.qos.logback.classic 1.5.6. But if i want to log something i get following:
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
I created the eclipse RCP described here:
https://www.vogella.com/tutorials/EclipseRCP/article.html
And the logback logger similar to here (i user later versions):
https://www.vogella.com/tutorials/EclipseLogging/article.html
Here the target platform:
<target name="target" sequenceNumber="43">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="file:////xxx.local/data/systeme/entwicklung/p2mirrors/xxx-thirdparty-libraries-release/1.12.0/"/>
<unit id="ch.qos.logback.classic" version="1.5.6"/>
<unit id="ch.qos.logback.core" version="1.5.6"/>
<unit id="slf4j.api" version="2.0.13"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/eclipse/updates/4.31/"/>
<unit id="org.eclipse.jdt.feature.group" version="3.19.400.v20240229-0520"/>
<unit id="org.eclipse.pde.feature.group" version="3.15.300.v20240229-0520"/>
<unit id="org.eclipse.platform.ide" version="4.31.0.I20240229-0520"/>
<unit id="org.eclipse.rcp.feature.group" version="4.31.0.v20240229-0520"/>
<unit id="org.eclipse.sdk.ide" version="4.31.0.I20240229-0520"/>
<unit id="org.eclipse.jdt.source.feature.group" version="3.19.400.v20240229-0520"/>
<unit id="org.eclipse.pde.source.feature.group" version="3.15.300.v20240229-0520"/>
<unit id="org.eclipse.rcp.source.feature.group" version="4.31.0.v20240229-0520"/>
<unit id="org.eclipse.emf.ecore.feature.group" version="2.37.0.v20240203-0859"/>
<unit id="org.eclipse.ecf.core.feature.feature.group" version="1.6.2.v20231021-2127"/>
<unit id="org.eclipse.emf.common.feature.group" version="2.31.0.v20231210-0956"/>
<unit id="org.eclipse.equinox.sdk.feature.group" version="3.23.1100.v20240218-1855"/>
</location>
</locations>
</target>
The Manifest:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Rcp
Bundle-SymbolicName: com.example.e4.rcp;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: EXAMPLE
Require-Bundle: org.eclipse.swt,
org.eclipse.e4.ui.model.workbench,
org.eclipse.jface,
org.eclipse.e4.ui.services,
org.eclipse.e4.ui.workbench,
org.eclipse.e4.core.di,
org.eclipse.e4.ui.di,
org.eclipse.e4.core.contexts,
org.eclipse.core.runtime,
slf4j.api;bundle-version="2.0.13",
ch.qos.logback.classic;bundle-version="1.5.6",
ch.qos.logback.core;bundle-version="1.5.6"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)",
jakarta.inject;version="[2.0.0,3.0.0)"
Automatic-Module-Name: com.example.e4.rcp
Logging class:
package com.example.e4.rcp.handlers;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AboutHandler {
@Execute
public void execute(Shell shell) {
MessageDialog.openInformation(shell, "About", "Eclipse RCP Application");
Logger LOG = LoggerFactory.getLogger(AboutHandler.class);
LOG.error("test");
}
}
The product:
<product name="com.example.e4.rcp" id="com.example.e4.rcp.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="1.0.0.qualifier" type="mixed" includeLaunchers="true" autoIncludeRequirements="true">
<configIni use="default">
</configIni>
<launcherArgs>
<programArgs>-clearPersistedState
</programArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
</vmArgsMac>
</launcherArgs>
<windowImages/>
<plugins>
<plugin id="ch.qos.logback.classic" version="1.5.6"/>
<plugin id="ch.qos.logback.core" version="1.5.6"/>
<plugin id="com.example.e4.rcp"/>
<plugin id="slf4j.api" version="2.0.13"/>
</plugins>
<features>
<feature id="org.eclipse.e4.rcp"/>
</features>
<configurations>
<plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
<plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
</configurations>
</product>
According to the manual here the logback-classic.jar on the class path will solve the problem:
https://www.slf4j.org/codes.html#noProviders
I would say the ch.qos.logback.classic is the logback-classic.jar in classpath. But problem still exists.