java.util.logging: how to suppress date line

后端 未结 3 957
日久生厌
日久生厌 2020-12-01 23:40

I\'m trying to suppress output of the date line durinng logging when using the default logger in java.util.logging. For example, here is a typical output:

Jun 1,         


        
3条回答
  •  北海茫月
    2020-12-02 00:23

    The problem is caused by a handler in the parent log. The solution is to remove all handlers from the parent log, and then add own custom handler. This code removes handlers from the parent log:

          for(Handler iHandler:log.getParent().getHandlers())
            {
            log.getParent().removeHandler(iHandler);
            }
    

提交回复
热议问题