Ok, that's really silly. In my application I use java.util.logging (and I need/want to use it, since some external components use it). For all the projects I've developed in every contest, from JSP to JSF to Swing etc... I've always used a custom logging formatter that puts every event in a single line (grep friendly) and with specific tabs that I've got acquainted to use and allow me to inspect thousands of lines in a very short time.

So far, I wasn't able to install it in my Wicket application.

This is what I have in my WebApplications subclass that gets initialized at startup:

    private void setupLogging ()
      {
        try
          {
InputStream is = getClass().getResourceAsStream("/ log.properties");
            LogManager.getLogManager().readConfiguration(is);
            is.close();

final PlainLogFormatter formatter = new PlainLogFormatter ();
            Logger rootLogger = Logger.getLogger(CLASS);

            while (rootLogger.getParent() != null)
              {
                rootLogger = rootLogger.getParent();
              }

            for (final Handler handler : rootLogger.getHandlers())
              {
                handler.setFormatter(formatter);
              }
          }
        catch (Exception e)
          {
            e.printStackTrace();
          }
      }

Indeed, log.properties is read and evaluated, in fact I can control the logging levels etc. I can configure everything BUT the formatter. If I specify it, I get the nigthmare XML formatter.

Even the code that navigates the loggers and manually sets the formatter doesn't work (for instance, I use it in a NetBeans RCP application where I know that the formatter can't be applied for classloader issues). But here it doesn't work. This is somewhat a minor issue, but now that I'm doing the final polishing I'd like to have logs like I want to see :-)

Thanks.



--
Fabrizio Giudici, Ph.D. - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
[EMAIL PROTECTED] - mobile: +39 348.150.6941


Reply via email to