Hide debug messages from FeedbackMessageFilter in wicket 1.5 during production?

StackOverflow https://stackoverflow.com/questions/14844714

  •  09-03-2022
  •  | 
  •  

Question

In developing some of my Web Applications I use debug("stuff here"); to help me figure out whats going on. I'd rather not have to go in and find all of my debug(*); lines and remove them. Is there a way I can specify at the application level not to display debug messages in a FeedBackPanel?

Était-ce utile?

La solution

You could add an ErrorLevelFeedbackMessageFilter to your FeedbackPanels (there is a constructor accepting one). If you create the filter based on your deployment mode, this should be what you need.

In Detail:

Change your new FeedbackPanel("id") to new FeedbackPanel("id", Application.getFeedbackMessageFilter()) and implement this method as

public IFeedbackMessageFilter getFeedbackMessageFilter() {
    IFeedbackMessageFilter filter = null;
    if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
        filter = new ErrorLevelFeedbackMessageFilter(FeedbackMessage.DEBUG);
    } else {
        filter = new ErrorLevelFeedbackMessageFilter(FeedbackMessage.ERROR);
    }
    return filter;
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top