0

How to implement log4j such that some desired loggers are not shown at PRODUCTION environment, but will show at test and acceptance environment.

Is it possible to do by using log4j only?

izaz
  • 11
  • 2
  • 7
  • assume you use spring or spring boot,you can make two log4j configure file and though [Profiles](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html) may be a way to to what you want. – TongChen Mar 28 '19 at 12:22
  • its an EJB application. Not sure about Profiles in EJB @TongChen – izaz Apr 01 '19 at 05:50

3 Answers3

1

You can use maven profiles . use different log4j.xml config file for every environment

欧阳葵
  • 21
  • 2
0

You Can use log4j for Production. But make sure that there is minimum usage of log in production. As less info and fatal can lead to less logger in production.

Lesser the logging faster the process, More the logging ,more verbose will be the server.

use warn precisely and only when there is any transaction happening with Database.

Hope it could help you!!!

0

You can work with the log4j defaults logs Levels, for example use minimal level DEBUG for test or acceptance environment and INFO for production.

Besides, you can implement your own custom log levels https://logging.apache.org/log4j/2.x/manual/customloglevels.html