5 Replies Latest reply on Mar 31, 2009 4:24 PM by 843789

    How to customise java.util.logging logs and export as text file?

      I'm trying to implement some simple logging to help me debug my basic jpeg decoder.

      I'm using java.util.logging and I'd like export a whole lot of logging data to a text file but I'd like to be able to format what info is sent and how it is presented to help me look through it later on.

      Most of the time I don't need any of the extra info like timestamp, class and log level, I just want the message that I wrote. Sometimes I just want line breaks so that the relevant info is grouped visually together.

      For example, using the vanilla settings I get an output of:
        <message>Different Tile:</message>
      However I'd like something like:
      *** Marker: DHT (Define Huffman Table) (xFFC4) ***
        OFFSET: 0x000000B1
        Huffman table length = 31
        Destination ID = 0
        Class = 0 (DC / Lossless Table)
          Codes of length 01 bits (000 total): 
          Codes of length 02 bits (001 total): 00 
          Codes of length 03 bits (005 total): 01 02 03 04 05 
          Codes of length 04 bits (001 total): 06 
          Codes of length 05 bits (001 total): 07 
          Codes of length 06 bits (001 total): 08 
          Codes of length 07 bits (001 total): 09 
          Codes of length 08 bits (001 total): 0A 
          Codes of length 09 bits (001 total): 0B 
          Codes of length 10 bits (000 total): 
          Codes of length 11 bits (000 total): 
          Codes of length 12 bits (000 total): 
          Codes of length 13 bits (000 total): 
          Codes of length 14 bits (000 total): 
          Codes of length 15 bits (000 total): 
          Codes of length 16 bits (000 total): 
          Total number of codes: 012
      I'm not too sure how I'd go about this. Thanks for any suggestions.

      EDIT: I guess I could write a style sheet for the standard xml file and not display the information elements that I don't want... If so, how would I link the stylesheet to the xml file generated? Seems it would require some hacky css to get the info formatted and displayed in the right way though. Not sure if that's the correct way to go about it.

      Edited by: mzatanoskas on Mar 30, 2009 7:21 AM