Created
February 22, 2012 18:34
-
-
Save yanaga/1886540 to your computer and use it in GitHub Desktop.
Sample production Spring @configuration bean for log4j
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileNotFoundException; | |
import javax.annotation.PostConstruct; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.Profile; | |
import org.springframework.util.Log4jConfigurer; | |
@Configuration | |
@Profile("production") | |
public class ProductionLog4jConfig { | |
@PostConstruct | |
public void initLog4j() throws FileNotFoundException { | |
Log4jConfigurer.initLogging("classpath:production-log4j.properties"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was very useful. Thanks!