Preferred Way To Do Logging In The SpringFrame Work

- 1 answer

I have done some searches looking for information about how to do logging with the Spring Framework.

We currently have an application that has no logging in it except for system.out statements (very bad way).

What I would like to do, is add logging, but also want to be able to control the logging at run time, with say JMX.

We are using Rad 7.0 / WebSphere 6.1

I am interesting to find out what is the best way(s) to accomplish this (I figure there may be several).

Update: Thoughts on the following Spring AOP Logging Good ideal or not. This is in reference to a question posted here on logging: Conditional Logging. Does this improve things or just makes it more difficult in the area of logging?



I would use Commons Logging and Log4j. This is not really a question for Spring, however the Springframework source does uses Commons Logging as well. If you create a log4j logger and appender in log4j, you can enable logging within the Springframework classes too. There are a few ways to control logging at runtime. The Log4j sandbox has a JSP, that you can drop into your webapp, that will allow you to control the log levels of all of the loggers within your application.