Shubham Sahay
Shubham Sahay

Reputation: 88

How to do logging in Spring boot for different log level in different files

I am new to spring boot and want to log different log levels to different files.

Is that possible, if yes please let me know what properties i need to define in application.properties file.

I have researched through some spring boot tutorials and could not find any solution for the same.

Please share links that could help me .

so expected result would be

  1. INFO level to go to a file in specific format like . somefilename_Info_dd/mm/yy_hh:mm:ss.

same with other log levels.

Thanks in advance.

Upvotes: 2

Views: 2401

Answers (1)

pethryth
pethryth

Reputation: 56

For many loggers try to use for example logback:

https://springframework.guru/using-logback-spring-boot/

These are different logging levels and its order from maximum to minimum:

TRACE - DEBUG - INFO -  WARN - ERROR

If you setup TRACE, it will log everything, if INFO, it will log INFO, WARN and ERROR.

You can read more on:

https://logback.qos.ch/manual/architecture.html

Upvotes: 1

Related Questions