Reputation: 21
My code:-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Logger logger = LoggerFactory.getLogger(MyService.class);
logger.info("");
i am getting this error ->
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-06-13 14:38:42.998 ERROR 12884 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Parameter 2 of constructor in com.myapp.app.service.MyService required a bean of type 'org.slf4j.Logger' that could not be found.
Action:
Consider defining a bean of type 'org.slf4j.Logger' in your configuration.
Process finished with exit code 1
Upvotes: 1
Views: 3520
Reputation: 135
Do you have some kind of a logger added as a dependency?
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.6.1</version>
</dependency>
Or can you show us your logger dependencies?
Also there are good tutorials for logging:
Upvotes: 0