0

I have been trying to figure out the best practices to do logging in my application which uses Spring MVC. If you could please help me understand and figure out the best practice.

For now I see two choices to implement logging in my application:

  1. Log4J logging (tradational approach non- AOP specific)

  2. AOP based logging

I would really appreciate answers that would make me understand which approach to be chosen with the benefits of each choice.

JimHawkins
  • 4,843
  • 8
  • 35
  • 55
Shahids
  • 93
  • 2
  • 8
  • 1
    Also, you should read up on [Logback](http://logback.qos.ch/reasonsToSwitch.html) and [Log4j 2](http://logging.apache.org/log4j/2.x/manual/index.html) which are superior to Log4j. – andyb Apr 16 '13 at 09:07
  • At a high level, the win from Log4j over manual logging is that you can decouple your logging code from what you actually want to log and where and how you want to log it. Details about logging verbosity/filtering, formatting, log location, and even log type (files, network, etc.) are handled declaratively using configuration and extensibly via custom appenders, rather you having to code that flexibility yourself. From developer's point of view, Log4j insulates you from having to make code changes to support logging, and insulates you from being pestered by people who want logging changes. – clever_bassi Jun 25 '14 at 19:06

1 Answers1

0

Log4J provides good flexibility by providing log4j.properties where you can configure what level of logging you are intersted in. I would recommend using the Log4J logging.

Here is a good reference point elaborating the Log4J logging levels.

Community
  • 1
  • 1