java.util.logging.Logger의 콘솔 출력 레벨 변경

  • Post author:
  • Post category:
  • Post comments:0 Comments
  • Post last modified:December 7, 2020

java.util.logging.Logger를 사용하는 경우 로깅 레벨을 코드상에서 변경 하더라도 콘솔에 출력되는 항목은 INFO 레벨 이상만 표시되게 된다. 이유는 기본적으로 참조하는 JAVA_HOMEjreliblogging.properties 파일에 콘솔항목은 INFO레벨 이상일 경우만 출력 하도록 되어 있으며 코드상에서 레벨을 변경 하더라도 둘의 교집합 영역만 표시되기 때문이다.

콘솔 출력과 관련한 기본 설정 값은 다음과 같다.

# Limit the message that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

로깅 레벨은 “java.util.logging.ConsoleHandler.level = INFO” 항목을 수정하여 변경할 수 있다. 참고로 java.util.logging.Logger에서 제공하는 로깅 레벨은 다음과 같다.

  • SEVERE (highest value)
  • WARNING
  • INFO
  • CONFIG
  • FINE
  • FINER
  • FINEST (lowest value)

참조하는 프로퍼티 파일의 위치를 변경하고 싶다면 VM 변수 “-Djava.util.logging.config.file=[프로퍼티 파일 위치]” 로 지정이 가능하다.

Author Details
Linus Lee aka y1sh former ATiMania.com sysop during 2001-2012. DevSecOps Engineer who likes tech, science, programming and solving problems 🙂
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments