Reputation: 83
I've been debugging the whole day and almost tried everything what the internet say about how to do it but I still don't get it correctly.
I am using Spring Boot and log4j2 for my logging because I want my logs to be written on a file instead of console. When I start Spring Boot, the log file is successfully created but I can't see "Hello Philippines" written on the file. I hope you can help me guys with this one.
Here is my Spring Boot Application:
My log4j2.xml
My POM:
I don't have any on my application.properties, this is the result when I run my application:
Upvotes: 3
Views: 1982
Reputation: 36103
The name of your logger in the log4j2.xml is com.example but the logger you create in your application is DemoApplication.
You should create your logger like this:
Logger logger = LoggerFactory.getLogger(DemoApplication.class);
Upvotes: 3