Redirect System.out.println to log

java, logging

Solution

My suggestion would be to refactor if possible. For a possible solution, check these similar questions

log4j redirect stdout to DailyRollingFileAppender

Redirect System.out.println to Log4J, while keeping class name information

Problem

In my project test suite there is big usage of ``` System.out.println ``` I'm trying to redirect these output to log file (through configuration or from single point without refactoring whole project ) so that can be disabled when necessary to improve performance. I'm using log4j for logging. Does any one know is this possible ? if so how to do it ? Thanks in advance.

Original source

Related problems