LOG Viewer ๊ตฌ์ถ• feat SeriLog

์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ œ์ž‘ํ•˜๋Š”๋ฐ ์žˆ์–ด Log๋Š” ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค.
์•„๋งˆ๋„ ๊ณผ๊ฑฐ Log4๋ฅผ ์‚ฌ์šฉํ•˜์‹œ๋‹ค๊ฐ€ Seri Log๋กœ ์ „ํ™˜ํ•˜์‹ ๋ถ„์ด ๋งŽ์„๊ฒƒ ๊ฐ™์€๋ฐ
SeriLog ์‚ฌ์šฉํ•˜๋Š” Tip์ž…๋‹ˆ๋‹ค.

Seq โ€” centralized structured logs ์—ฌ๊ธฐ์—์„œ Seri Seq ์„ ๋‹ค์šด๋กœ๋“œ ํ•ฉ๋‹ˆ๋‹ค.
์„ค์น˜ ํŒŒ์ผ์ด๋ผ ๋ณ„๋‹ค๋ฅธ ์กฐ์ž‘์—†์ด ์„ค์น˜ ํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

image

์ตœ์ดˆ ์„ค์น˜์‹œ Port ์™€ admin๊ณ„์ •์„ ์„ค์ •ํ•ด์ค๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด PC์— ์ธ์Šคํ„ด์Šค๊ฐ€ ์˜ฌ๋ผ๊ฐ€๊ณ 

๋ณดํ†ต localhost:5341 ๋ฅผ ์˜คํ”ˆํ•˜์‹œ๊ณ  ๋กœ๊ทธ์ธ ํ•˜์‹ ๋‹ค์Œ์—

Setting->Api ํ‚ค์—์„œ ํ‚ค๋ฅผ ๋ฐœ๊ธ‰ ๋ฐ›์Šต๋‹ˆ๋‹ค.

image

builder.Host.UseSerilog((_, config) =>
{
	config.WriteTo.Console()
	.WriteTo.Seq("http://192.168.0.11:5341", apiKey: "9SzGXY7qrQZJ6oUAoMCQ")
	.ReadFrom.Configuration(builder.Configuration);
});

๊ทธ๋ฆฌ๊ณ  Program.cs์—์„œ writo.seq(url, apikey);
์ž…๋ ฅ ํ•˜๊ณ  LOG๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๋ฉด

์ด๋ ‡๊ฒŒ log viewer ๊ฐ„๋‹จํ•˜๊ฒŒ ํ™•์ธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
์‚ฌ๋‚ด ํ…Œ์ŠคํŠธ ํ•˜๋Š” ๋‹จ์ผ ๋„๋ฉ”์ธ ๊ฒฝ์šฐ ๋ฌด๋ฃŒ๋กœ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•œ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๊ฒ€์ƒ‰ ๋ฐ ํ†ต๊ณ„ ์ƒ๋‹นํžˆ Rich ํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋ƒฅ Seq๋ฅผ ์„ค์น˜ํ•˜๊ณ  Seri Log WriteTo๋งŒ ํ•ด๋„ ๋ ์ •๋„๋กœ ์ •๋ง ๊ฐ„ํŽธํ•˜๊ณ  ์‰ฝ๊ฒŒ ์šด์šฉํ•˜์‹ค์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด๊ฒƒ ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ตฌ์ถ•ํ•˜์‹œ๊ณ  ์ธ์‚ฌ๊ณ ๊ณผ์—์„œ ์ข‹์€ ํ‰๊ฐ€ ๋ฐ›์•„๋ณด์„ธ์š” ใ…Žใ…Žใ…Ž
์—ฐ๋ด‰ ํ˜‘์ƒํ•˜์‹ค๋•Œ ์œ ๋ฆฌํ•ด์ง€์‹ญ๋‹ˆ๋‹ค.

13 Likes