๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Java

[Java] log4j Log ๋ ˆ๋ฒจ

by cheezzz 2022. 1. 7.
๋ฐ˜์‘ํ˜•

๋กœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ชฉ์ 

์„œ๋น„์Šค ๋™์ž‘ ๋ฐ ์žฅ์•  ์ƒํƒœ ํŒŒ์•…

 

log4j

Log for Java
๋‹ค์–‘ํ•œ ๋Œ€์ƒ์œผ๋กœ ๋กœ๊ทธ๋ฅผ ์ถœ๋ ฅ ํ•  ์ˆ˜ ์žˆ๋Š” ์˜คํ”ˆ์†Œ์Šค ์ž…๋‹ˆ๋‹ค
System.out.println()์„ ์‚ฌ์šฉํ•˜๋ฉด ํ•ด๋‹น ๋กœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ์‹ถ์„๋•Œ ์‚ญ์ œํ•ด์•ผํ•˜์ง€๋งŒ,
log4j์˜ ๋กœ๊ทธ๋ ˆ๋ฒจ์„ ์‚ฌ์šฉํ•˜๋ฉด ์›ํ•˜๋Š” ๋ฒ”์œ„์˜ ๋กœ๊ทธ๋งŒ ์ถœ๋ ฅํ•  ์ˆ˜ ์žˆ์–ด ํŽธ๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์šด๋กœ๋“œ ๋งํฌ: https://logging.apache.org/log4j/1.2/download.html

 

Apache log4j 1.2 - Download Apache log4j 1.2

Log4j 2 is nominated for the JAX Innovation Awards! Do you like its performance, garbage-free logging, and easy and flexible configuration? Log4j 2 needs your love. Vote for Log4j 2! End of Life On August 5, 2015 the Logging Services Project Management Com

logging.apache.org

 

Log level

log4j ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด 6๋‹จ๊ณ„์˜ event level์„ Config level ์„ค์ •์— ๋”ฐ๋ผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค

TRACE : Debug๋ณด๋‹ค ๋” ์ƒ์„ธํ•œ ์ •๋ณด
DEBUG : ํ”„๋กœ๊ทธ๋žจ ๋””๋ฒ„๊น… ์œ„ํ•œ ์ •๋ณด
INFO :  ์ƒํƒœ๋ณ€๊ฒฝ๊ณผ ๊ฐ™์€ ์ •๋ณด์„ฑ ๋ฉ”์‹œ์ง€
WARN :  ์ฒ˜๋ฆฌ ๊ฐ€๋Šฅํ•œ ๋ฌธ์ œ, ํ–ฅํ›„ ์‹œ์Šคํ…œ ์—๋Ÿฌ์˜ ์›์ธ์ด ๋  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ๊ณ ์„ฑ ๋ฉ”์‹œ์ง€
ERROR :  ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ
FATAL :  ์•„์ฃผ ์‹ฌ๊ฐํ•œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ ์ƒํƒœ, ์‹œ์Šคํ…œ์ ์œผ๋กœ ์‹ฌ๊ฐํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ด์„œ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ž‘๋™์ด ๋ถˆ๊ฐ€๋Šฅํ•  ๊ฒฝ์šฐ

 

Log level ์ˆœ์„œ

TRACE > DEBUG > INFO > WARN > ERROR > FATAL

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€