Thursday, May 3, 2012

Configure log4j for Spring MVC

1. Add following to web.xml


    log4jConfigLocation
    
    classpath:log4j.properties


    log4jExposeWebAppRoot
    false




    org.springframework.web.util.Log4jConfigListener

2. Create log4j factory bean in applicationContext.xml


3. Use it


@Component
public class SomeComponent{
    private Log logger;
  
    @Resource
    public void setLogger(Log logger){
       this.logger=logger;
    }


}

Sample log4j.properties
Spring MVC Sample Project

14 comments:

  1. Very happy to see this blog. Gives a wonderful information with coded explanaion. Thank you for this blog. very useful to me.
    Java Training in Chennai

    ReplyDelete
  2. Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete
  3. Thanks for sharing this unique information with us. Your post is really awesome. Your blog is really helpful for me..
    Top college in Jaipur

    ReplyDelete
  4. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end. 
    microsoft azure training in bangalore
    rpa training in bangalore
    best rpa training in bangalore

    ReplyDelete
  5. Nice article
    For Data Science training in Bangalore, Visit:
    Data Science training in bangalore

    ReplyDelete
  6. Such a great information for blogger iam a professional blogger thanks…

    Get Best Dell Boomi Training in Bangalorev from Real Time Industry Experts with 100% Placement Assistance in MNC Companies. Book your Free Demo with Softgen Infotech.

    ReplyDelete
  7. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up. spring boot certification course!

    ReplyDelete
  8. Advanced System Repair Pro 1.9.9.2 Crack is one of the best and effective tools designed to scan, detect, and fix errors in your Windows system.Advanced System Repair Pro License Key 2022

    ReplyDelete
  9. Microsoft Office, or simply Office, is a family of client software, server software, and services developed by Microsoft. It was first announced by Bill .Microsoft Office Free Download

    ReplyDelete
  10. Use between herself his section race father relationship. Rule beat federal. Reflect professional though beautiful eight another send.education

    ReplyDelete