Subclassing java.util.logging.Formatter doesn't work

后端 未结 5 861
自闭症患者
自闭症患者 2021-01-06 16:23

I am using java.util.logging for logging (I don\'t want to use log4j or anything else).

This is my complete private logging.properties:

         


        
5条回答
  •  暖寄归人
    2021-01-06 16:59

    Ok this one really annoyed me too, and was driving me nuts, I was checking the spelling endlessly, doing google searching etc - which is how I got here - I know this is a year old, but your going to kick yourself. Here is what I am pretty sure is your answer.

    For :

    java.util.logging.FileHandler.formatter = com.mycomp.myproj.LogFormatter;
    

    That should be :

    java.util.logging.FileHandler.formatter = com.mycomp.myproj.LogFormatter
    

    Drop the training ";". It seems to need to match exactly to the class name I saw someone else complain they had trailing white space characters - which was what my problem was. A better error message would have been helpful.

    Cheers - Mark

提交回复
热议问题