3
votes

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:

enter image description here

My log4j2.xml

enter image description here

My POM:

enter image description here

I don't have any on my application.properties, this is the result when I run my application:

enter image description here

1

1 Answers

3
votes

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);