Ramesh Sapkota
Ramesh Sapkota

Reputation: 55

Filter the mail generated from the Log4j

I would like to set the filter in log4j properties in a such way that log4j can only generate the MYSQL related mail. Now i am getting all type of mails from it. I have tried by adding following codes but it has stopped generating the mysql related mail. So, can you guys help me out on this?

        def expFilter = new org.apache.log4j.filter.ExpressionFilter()
        expFilter.setExpression('EXCEPTION ~= com.mysql.jdbc')
        expFilter.setAcceptOnMatch(false)
        expFilter.activateOptions()
        mailAppender.headFilter = expFilter 

Thanks,

Upvotes: 0

Views: 47

Answers (0)

Related Questions