WicketRuntimeException
.Given that Wicket relies on SLF4J for logging, the
WicketRuntimeException
is logged as an error. To keep abreast of errors in our e-commerce applications, we use SMTPAppender
in our logging configuration. Thus, every event logged as an error triggers an email to our site's administrator. As you can imagine, receiving over 30 emails per day as a result of erroneous Googlebot submissions defeats the purpose of these log report sent by email. (After the 100th bogus email, the admin stops caring.)Below is a configuration file which instructs
SMTPAppedner
to ignore errors generated by Googlebot. <configuration scan="true"> <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender"> <layout class="ch.qos.logback.classic.html.HTMLLayout"> <pattern> %date%-5level%thread%X{req.remoteHost}%logger%msg </pattern> </layout> <From>...</From> <SMTPHost>...</SMTPHost> <Subject>[${HOSTNAME}] %msg</Subject> <To>...</To> <evaluator class="ch.qos.logback.classic.boolex.JaninoEventEvaluator"> <expression> level>=WARN && !( mdc.get("req.userAgent") != null && ((String) mdc.get("req.userAgent")).contains("Googlebot")) </expression> </evaluator> </appender> <root level="INFO"> <appender-ref ref="EMAIL" /> </root> </configuration>
It relies heavily on
JaninoEventEvaluator
and requires the installation of MDCInsertingServletFilter
.You could also throw in markers into the mix as described in a previous post. It should be noted that the googlebot problem should be addressed by setting an internal error page but that's a different story.
No comments:
Post a Comment