-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Logging ko KR
ASF๋ ๋ฐํ์ ์ค ์ฌ์ฉ๋ ์ฌ์ฉ์ ์ง์ ์ปค์คํ
๋ก๊น
๋ชจ๋์ ์ค์ ํ ์ ์๋๋ก ํด์ค๋๋ค. ์ ํ๋ฆฌ์ผ์ด์
๋๋ ํ ๋ฆฌ์ NLog.config๋ผ๋ ํน์ ํ์ผ์ ๋ฐฐ์นํ๋ฉด ์ด ๊ธฐ๋ฅ์ ์ฌ์ฉํ์ค ์ ์์ต๋๋ค. NLog์ ์ ์ฒด ๋ฌธ์๋ **NLog ์ํค**์์ ํ์ธํ์ค ์ ์์ผ๋ฉฐ, ์ด์ ๋ํด ์ฌ๊ธฐ์๋ ์ ์ฉํ ์์๋ค์ ํจ๊ป ์ ๊ณตํด๋๋ฆฝ๋๋ค.
๊ธฐ๋ณธ์ ์ผ๋ก ASF๋ ColoredConsole(ํ์ค ์ถ๋ ฅ)๊ณผ File์ ๋ก๊ทธ๋ฅผ ๊ธฐ๋กํฉ๋๋ค. File ๋ก๊น
์๋ ํ๋ก๊ทธ๋จ ๋๋ ํ ๋ฆฌ์ log.txt ํ์ผ๊ณผ, ๋ณด๊ด ๋ชฉ์ ์ logs ๋๋ ํ ๋ฆฌ๊ฐ ํฌํจ๋ฉ๋๋ค.
์ปค์คํ
NLog ์ค์ ์ ์ฌ์ฉํ๋ฉด ๊ธฐ๋ณธ ASF ์ค์ ์ด ์๋์ผ๋ก ๋นํ์ฑํ๋ฉ๋๋ค. ์ฆ, ์ฌ์ฉ์์ ์ค์ ์ด ๊ธฐ๋ณธ ASF ๋ก๊น
์ ์์ ํ ๋ฎ์ด์ฐ๋ฏ๋ก, ์๋ฅผ ๋ค์ด ์ ํฌ์ ColoredConsole ํ๊ฒ์ ๊ณ์ ์ ์งํ๊ณ ์ถ์ผ์๋ค๋ฉด ์ง์ ์ ์ํ์
์ผ ํฉ๋๋ค. ์ด๋ฅผ ํตํด ์ถ๊ฐ ๋ก๊น
ํ๊ฒ์ ๋ํ ์ ์์ ๋ฟ๋ง ์๋๋ผ, ๊ธฐ๋ณธ ํ๊ฒ์ ๋นํ์ฑํํ๊ฑฐ๋ ์์ ํ ์๋ ์์ต๋๋ค.
๊ธฐ๋ณธ ASF ๋ก๊น
์ ์๋ฌด๋ฐ ์์ ์์ด ๊ทธ๋๋ก ์ฌ์ฉํ๊ณ ์ถ์ผ์๋ค๋ฉด, ๋ณ๋๋ก ์๋ฌด๊ฒ๋ ํ์ค ํ์๊ฐ ์์ต๋๋ค - ์ปค์คํ
NLog.config์ ์ ์ํ์ค ํ์๋ ์์ต๋๋ค. ์ฐธ๊ณ ๋ก, ํ๋์ฝ๋ฉ๋ ๊ธฐ๋ณธ ASF ๋ก๊น
๊ณผ ๋๋ฑํ ์ค์ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="ColoredConsole" name="ColoredConsole" layout="${date:format=yyyy-MM-dd HH\:mm\:ss}|${processname}-${processid}|${level:uppercase=true}|${logger}|${message}${onexception:inner= ${exception:format=toString,Data}}" />
<target xsi:type="File" name="File" archiveFileName="${currentdir:cached=true}/logs/log.txt" archiveOldFileOnStartup="true" archiveSuffixFormat=".{1:yyyyMMdd-HHmmss}" fileName="${currentdir:cached=true}/log.txt" layout="${date:format=yyyy-MM-dd HH\:mm\:ss}|${processname}-${processid}|${level:uppercase=true}|${logger}|${message}${onexception:inner= ${exception:format=toString,Data}}" maxArchiveFiles="10" />
<!-- Below becomes active when ASF's IPC interface is started -->
<target type="History" name="History" layout="${date:format=yyyy-MM-dd HH\:mm\:ss}|${processname}-${processid}|${level:uppercase=true}|${logger}|${message}${onexception:inner= ${exception:format=toString,Data}}" maxCount="20" />
</targets>
<rules>
<!-- The following entries specify ASP.NET (IPC) logging, we declare those so our last Debug catch-all doesn't include ASP.NET logs by default -->
<logger name="Microsoft.Hosting.Lifetime" finalMinLevel="Info" writeTo="ColoredConsole" />
<logger name="Microsoft.*" finalMinLevel="Warn" writeTo="ColoredConsole" />
<logger name="System.*" finalMinLevel="Warn" writeTo="ColoredConsole" />
<logger name="*" minlevel="Debug" writeTo="ColoredConsole" />
<!-- The following entries specify ASP.NET (IPC) logging, we declare those so our last Debug catch-all doesn't include ASP.NET logs by default -->
<logger name="Microsoft.Hosting.Lifetime" finalMinLevel="Info" writeTo="File" />
<logger name="Microsoft.*" finalMinLevel="Warn" writeTo="File" />
<logger name="System.*" finalMinLevel="Warn" writeTo="File" />
<logger name="*" minlevel="Debug" writeTo="File" />
<!-- Below becomes active when ASF's IPC interface is enabled -->
<!-- The following entries specify ASP.NET (IPC) logging, we declare those so our last Debug catch-all doesn't include ASP.NET logs by default -->
<logger name="Microsoft.Hosting.Lifetime" finalMinLevel="Info" writeTo="History" />
<logger name="Microsoft.*" finalMinLevel="Warn" writeTo="History" />
<logger name="System.*" finalMinLevel="Warn" writeTo="History" />
<logger name="*" minlevel="Debug" writeTo="History" />
</rules>
</nlog>ASF๋ NLog์์ ํตํฉ์ ๊ฐํํ๋ ๋ช ๊ฐ์ง ์ ์ฉํ ์ฝ๋ ๊ธฐ๋ฒ๋ค์ ํฌํจํ๊ณ ์์ด, ํน์ ๋ฉ์์ง๋ฅผ ๋์ฑ ์ฝ๊ฒ ํฌ์ฐฉํ ์ ์๊ฒ ํด์ค๋๋ค.
NLog ์ ์ฉ ${logger} ๋ณ์๋ ํญ์ ๋ฉ์์ง์ ์ถ์ฒ๋ฅผ ๊ตฌ๋ถํด์ค๋๋ค - ์ด๋ ์ฌ์ฉ์์ ๋ด ์ค ํ๋์ BotName์ด๊ฑฐ๋, ๋ฉ์์ง๊ฐ ASF ํ๋ก์ธ์ค์์ ์ง์ ๋ฐ์ํ ๊ฒฝ์ฐ๋ผ๋ฉด ASF๊ฐ ๋ฉ๋๋ค. ์ด ๋ฐฉ์์ ํตํด, ๋ก๊ฑฐ์ ์ด๋ฆ์ ๊ธฐ์ค์ผ๋ก ์ ์ฒด ๋ฉ์์ง ๋์ ํน์ ๋ด(๋ค)์ด๋ ASF ํ๋ก์ธ์ค(๋จ๋
)์ ๊ด๋ จ๋ ๋ฉ์์ง๋ง ์์ฝ๊ฒ ํฌ์ฐฉํ์ค ์ ์์ต๋๋ค.
ASF๋ NLog๊ฐ ์ ๊ณตํ๋ ๋ก๊น ๋ ๋ฒจ์ ๊ธฐ์ค์ผ๋ก ๋ฉ์์ง์ ์ ์ ํ ํ๊ทธ๋ฅผ ์ง์ ํ๋ ค ์๋ํ๋ฉฐ, ์ด๋ฅผ ํตํด ์ ์ฒด ๋ฉ์์ง ๋์ ํน์ ๋ก๊ทธ ๋ ๋ฒจ์ ๋ฉ์์ง๋ง ํฌ์ฐฉํ์ค ์ ์์ต๋๋ค. ๋ฌผ๋ก , ํน์ ๋ฉ์์ง์ ๋ก๊น ๋ ๋ฒจ์ ์ฌ์ฉ์๊ฐ ์์๋ก ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค. ์ด๋ ํด๋น ๋ฉ์์ง๊ฐ ์ผ๋ง๋ ์ฌ๊ฐํ์ง์ ๋ํ ASF์ ํ๋์ฝ๋ฉ๋ ํ๋จ์ด๊ธฐ ๋๋ฌธ์ ๋๋ค. ๋ค๋ง ์ํ์๋ ๋๋ก ASF์ ๋ก๊ทธ ์ถ๋ ฅ๋์ ๋ ์ ๊ฒ ๋๋ ๋ ๋ง๊ฒ ์กฐ์ ํ๋ ๊ฒ์ ํ์คํ ๊ฐ๋ฅํฉ๋๋ค.
ASF๋ ์ฌ์ฉ์/์ฑํ
๋ฉ์์ง์ ๊ฐ์ ์ถ๊ฐ ์ ๋ณด๋ฅผ Trace ๋ก๊น
๋ ๋ฒจ์์ ๊ธฐ๋กํฉ๋๋ค. ๊ธฐ๋ณธ ASF ๋ก๊น
์ Debug ๋ ๋ฒจ ์ด์๋ง ๊ธฐ๋กํ๋ฉฐ, ์ด๋ ๋๋ค์์ ์ฌ์ฉ์์๊ฒ ๋ถํ์ํ ์ถ๊ฐ ์ ๋ณด๋ฅผ ์จ๊ธฐ๊ณ , ๋ ์ค์ํ ์ ์๋ ๋ฉ์์ง๊ฐ ํฌํจ๋ ์ถ๋ ฅ ๊ฒฐ๊ณผ๊ฐ ์ง์ ๋ถํด์ง๋ ๊ฒ์ ๋ฐฉ์งํ๊ธฐ ์ํจ์
๋๋ค. ๋ค๋ง Trace ๋ก๊น
๋ ๋ฒจ์ ๋ค์ ํ์ฑํํ๋ฉด ์ด ์ ๋ณด๋ฅผ ํ์ฉํ์ค ์ ์์ต๋๋ค. ํนํ ๊ด์ฌ ์๋ ํน์ ์ด๋ฒคํธ์ ํจ๊ป, ์ํ๋ ๋ด ํ๋๋ง ๋ก๊น
ํ๋๋ก ์กฐํฉํ๋ ๊ฒฝ์ฐ ๋์ฑ ์ ์ฉํฉ๋๋ค.
์ผ๋ฐ์ ์ผ๋ก ASF๋ grep๊ณผ ๊ฐ์ ์ 3์ ๋๊ตฌ๋ก ์ฌ์ฉ์๊ฐ ์ง์ ์๋์ผ๋ก ํํฐ๋งํ๋๋ก ๊ฐ์ ํ๋ ๋์ , ์ํ๋ ๋ฉ์์ง๋ง ๋ก๊ทธ๋ก ๋จ๊ธธ ์ ์๋๋ก ์ต๋ํ ์ฝ๊ณ ํธ๋ฆฌํ๊ฒ ๋ง๋ค๋ ค๊ณ ๋
ธ๋ ฅํฉ๋๋ค. ์๋์ ์ค๋ช
๋ ๋๋ก NLog๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์ ํ๊ธฐ๋ง ํ๋ฉด, ์ ์ฒด ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ๊ฐ์ ์ปค์คํ
ํ๊ฒ์ ํฌํจํ์ฌ ๋งค์ฐ ๋ณต์กํ ๋ก๊น
๊ท์น๊น์ง๋ ์ง์ ํ์ค ์ ์์ต๋๋ค.
๋ฒ์ ๊ด๋ฆฌ์ ๊ด๋ จํ์ฌ - ASF๋ ASF ๋ฆด๋ฆฌ์ค ์์ ๊ธฐ์ค์ผ๋ก **NuGet**์์ ๊ตฌํ ์ ์๋ ๊ฐ์ฅ ์ต์ ๋ฒ์ ์ NLog๋ฅผ ํญ์ ํจ๊ป ๋ฐฐํฌํ๋ ค๊ณ ๋ ธ๋ ฅํฉ๋๋ค. NLog ์ํค์์ ์ฐพ์ ์ ์๋ ์ด๋ค ๊ธฐ๋ฅ์ด๋ ASF์์ ์ฌ์ฉํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์ด์ผ ํฉ๋๋ค - ๋ค๋ง ์ต์ ๋ฒ์ ์ ASF๋ฅผ ์ฌ์ฉํ๊ณ ๊ณ์ ์ง๋ง ํ์ธํด ์ฃผ์ธ์.
ASF ํตํฉ์ ์ผํ์ผ๋ก, ASF๋ ์๋์์ ์ค๋ช ํ ์ถ๊ฐ์ ์ธ ASF ์ ์ฉ NLog ๋ก๊น ํ๊ฒ๋ ์ง์ํฉ๋๋ค.
์๋์ ์์๋ค์ ์ํ๋ ๋๋ก ๋ก๊น ์ ์ปค์คํฐ๋ง์ด์งํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ๋๋ฆฝ๋๋ค.
์์์ผ๋ก ColoredConsole ํ๊ฒ๋ง ์ฌ์ฉํด๋ณด๊ฒ ์ต๋๋ค. ์ ํฌ์ ์ด๊ธฐ NLog.config๋ ๋ค์๊ณผ ๊ฐ์ ๋ชจ์ต์
๋๋ค:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="ColoredConsole" name="ColoredConsole" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="ColoredConsole" />
</rules>
</nlog>์ ์ค์ ์ ๋ํ ์ค๋ช
์ ๋งค์ฐ ๊ฐ๋จํฉ๋๋ค - ์ ํฌ๋ ColoredConsole์ด๋ผ๋ ํ๋์ ๋ก๊น
ํ๊ฒ์ ์ ์ํ ๋ค์, Debug ๋ ๋ฒจ ์ด์์ ๋ชจ๋ ๋ก๊ฑฐ(*)๋ฅผ ์์ ์ ์ํ ColoredConsole ํ๊ฒ์ผ๋ก ๋ฆฌ๋ค์ด๋ ํธํฉ๋๋ค.
๋ง์ฝ ์ง๊ธ ์์ NLog.config๋ก ASF๋ฅผ ์์ํ๋ฉด, ColoredConsole ํ๊ฒ๋ง ํ์ฑํ๋๋ฉฐ, ํ๋์ฝ๋ฉ๋ ASF NLog ์ค์ ๊ณผ ๊ด๊ณ์์ด ASF๋ File์ ๊ธฐ๋กํ์ง ์๊ฒ ๋ฉ๋๋ค.
layout๊ณผ ๊ฐ์ ์ฌ๋ฌ ์์ฑ์ ๋ณ๋๋ก ์ ์ํ์ง ์์๊ธฐ ๋๋ฌธ์, ๊ธฐ๋ณธ ๋ด์ฅ๊ฐ์ธ ${longdate}|${level:uppercase=true}|${logger}|${message}๋ก ์ด๊ธฐํ๋์์ต๋๋ค. ์ด๋ฅผ ์ปค์คํฐ๋ง์ด์งํ ์๋ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ๋ฉ์์ง๋ง ๊ธฐ๋กํ๋๋ก ๋ค์๊ณผ ๊ฐ์ด ์ค์ ํ ์ ์์ต๋๋ค:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="ColoredConsole" name="ColoredConsole" layout="${message}" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="ColoredConsole" />
</rules>
</nlog>์ด์ ASF๋ฅผ ์คํํ์๋ฉด, ๋ ์ง, ๋ ๋ฒจ, ๋ก๊ฑฐ ์ด๋ฆ์ด ์ฌ๋ผ์ง๊ณ Function() Message ํ์์ ASF ๋ฉ์์ง๋ง ๋จ๋ ๊ฒ์ ํ์ธํ์ค ์ ์์ต๋๋ค.
๋ํ ์ค์ ์ ์์ ํ์ฌ ๋ ๊ฐ ์ด์์ ํ๊ฒ์ ๋ก๊ทธ๋ฅผ ๊ธฐ๋กํ ์๋ ์์ต๋๋ค. ColoredConsole๊ณผ **File**์ ๋์์ ๋ก๊ทธ๋ฅผ ๊ธฐ๋กํด๋ด
์๋ค.
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="ColoredConsole" name="ColoredConsole" />
<target xsi:type="File" name="File" fileName="${currentdir:cached=true}/NLog.txt" deleteOldFileOnStartup="true" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="ColoredConsole" />
<logger name="*" minlevel="Debug" writeTo="File" />
</rules>
</nlog>์๋ฃ๋์์ต๋๋ค. ์ด์ ๋ชจ๋ ๊ฒ์ด ColoredConsole๊ณผ File์ ๋ก๊ทธ๋ก ๊ธฐ๋ก๋ฉ๋๋ค. ์ฌ์ฉ์ ์ง์ fileName์ด๋ ์ถ๊ฐ ์ต์
๋ ์ค์ ํ ์ ์๋ค๋ ๊ฒ์ ๋์น์ฑ์
จ๋์?
๋ง์ง๋ง์ผ๋ก, ASF๋ ์ฌ์ฉ์๊ฐ ํ์ฌ ์ํฉ์ ๋ ์ฝ๊ฒ ์ดํดํ ์ ์๋๋ก ๋ค์ํ ๋ก๊ทธ ๋ ๋ฒจ์ ์ฌ์ฉํฉ๋๋ค. ์ด ์ ๋ณด๋ฅผ ํ์ฉํ์ฌ ๋ก๊น
์ ์ฌ๊ฐ๋(severity)๋ฅผ ์์ ํ ์ ์์ต๋๋ค. ๋ชจ๋ ๊ฒ์(Trace) File์ ๊ธฐ๋กํ๋, ColoredConsole์๋ Warning ์ด์์ **๋ก๊ทธ ๋ ๋ฒจ**๋ง ๊ธฐ๋กํ๊ณ ์ถ๋ค๊ณ ๊ฐ์ ํด๋ด
์๋ค. rules๋ฅผ ์์ ํ์ฌ ์ด๋ฅผ ๋ฌ์ฑํ ์ ์์ต๋๋ค:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="ColoredConsole" name="ColoredConsole" />
<target xsi:type="File" name="File" fileName="${currentdir:cached=true}/NLog.txt" deleteOldFileOnStartup="true" />
</targets>
<rules>
<logger name="*" minlevel="Warn" writeTo="ColoredConsole" />
<logger name="*" minlevel="Trace" writeTo="File" />
</rules>
</nlog>์ด๋ ๊ฒ ํ๋ฉด, ์ด์ ์ ํฌ์ ColoredConsole์ ๊ฒฝ๊ณ (warning) ์ด์๋ง ํ์ํ๊ณ , File์๋ ์ฌ์ ํ ๋ชจ๋ ๊ฒ์ ๊ธฐ๋กํฉ๋๋ค. ์๋ฅผ ๋ค์ด Info ์ดํ๋ง ๊ธฐ๋กํ๋ ๋ฑ, ์ํ๋ ๋๋ก ๋ ์ธ๋ฐํ๊ฒ ์กฐ์ ํ์ค ์๋ ์์ต๋๋ค.
๋ง์ง๋ง์ผ๋ก, ์กฐ๊ธ ๋ ๊ณ ๊ธ ๊ธฐ๋ฅ์ ์ฌ์ฉํด์ LogBot์ด๋ผ๋ ์ด๋ฆ์ ๋ด์์ ๋ฐ์ํ ๋ฉ์์ง๋ง ํ์ผ์ ๊ธฐ๋กํด๋ด
์๋ค.
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="ColoredConsole" name="ColoredConsole" />
<target xsi:type="File" name="LogBotFile" fileName="${currentdir:cached=true}/LogBot.txt" deleteOldFileOnStartup="true" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="ColoredConsole" />
<logger name="LogBot" minlevel="Trace" writeTo="LogBotFile" />
</rules>
</nlog>์์์ ์ฌ์ฉํ ASF ํตํฉ ๊ธฐ๋ฅ์ ํ์ฉํ์ฌ ${logger} ์์ฑ์ ๊ธฐ์ค์ผ๋ก ๋ฉ์์ง์ ์ถ์ฒ๋ฅผ ์์ฝ๊ฒ ๊ตฌ๋ถํ ๋ฐฉ์์ ํ์ธํ์ค ์ ์์ต๋๋ค.
์์ ์์๋ค์ ASF์ ํจ๊ป ์ฌ์ฉํ ์ ์๋ ๋๋ง์ ๋ก๊น
๊ท์น์ ์ ์ํ๋ ๊ฒ์ด ์ผ๋ง๋ ์ฌ์ด์ง ๋ณด์ฌ๋๋ฆฌ๊ธฐ ์ํด ๋น๊ต์ ๊ฐ๋จํ๊ฒ ๋ง๋ค์ด์ก์ต๋๋ค. NLog๋ ๋ค์ํ ์ฉ๋๋ก ํ์ฉํ์ค ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด Database์ ๋ก๊ทธ๋ฅผ ๋ณด๊ดํ๋ ๊ฒ๊ณผ ๊ฐ์ ๋ณต์กํ ํ๊ฒ, (์ค๋๋ File ๋ก๊ทธ๋ฅผ ์ ๊ฑฐํ๋ ๊ฒ๊ณผ ๊ฐ์) ๋ก๊ทธ ์ํ(rotation), ์ปค์คํ
Layout ์ฌ์ฉ, ์์ ๋ง์ <when> ๋ก๊น
ํํฐ ์ ์ธ ๋ฑ ๋ค์ํ ํ์ฉ์ด ๊ฐ๋ฅํฉ๋๋ค. ์ํ์๋ ๋๋ก ASF ๋ก๊น
๋ชจ๋์ ์ธ๋ฐํ๊ฒ ์กฐ์ ํ ์ ์๋๋ก, ์ด์ฉ ๊ฐ๋ฅํ ๋ชจ๋ ์ต์
์ ์์๋ณด๊ธฐ ์ํด ์ ์ฒด **NLog ๋ฌธ์**๋ฅผ ๊ผญ ์ฝ์ด๋ณด์๊ธธ ๊ถ์ฅ๋๋ฆฝ๋๋ค. ์ด๋ ์ ๋ง ๊ฐ๋ ฅํ ๋๊ตฌ์ด๋ฉฐ, ASF ๋ก๊น
์ ์ปค์คํฐ๋ง์ด์งํ๋ ๊ฒ์ด ์ด๋ณด๋ค ๋ ์ฌ์ด ์ ์ ์์์ต๋๋ค.
ASF๋ ์ฌ์ฉ์ ์
๋ ฅ์ ๊ธฐ๋ค๋ฆด ๋, ColoredConsole์ด๋ Console ํ๊ฒ์ด ํฌํจ๋ ๋ชจ๋ ๊ท์น์ ์ผ์์ ์ผ๋ก ๋นํ์ฑํํฉ๋๋ค. ๋ฐ๋ผ์ ASF๊ฐ ์ฌ์ฉ์ ์
๋ ฅ์ ๊ธฐ๋ค๋ฆฌ๋ ๋์์๋ ๋ค๋ฅธ ํ๊ฒ์ ๋ํ ๋ก๊น
์ ๊ณ์ ์ ์งํ๊ณ ์ถ์ผ์๋ค๋ฉด, ์ ์์์์ ๋ณด์ฌ๋๋ฆฐ ๊ฒ์ฒ๋ผ ํด๋น ํ๊ฒ๋ค์ ์์ ๋ง์ ๋ณ๋ ๊ท์น์ผ๋ก ์ ์ํ์
์ผ ํฉ๋๋ค. ๋์ผํ ๊ท์น์ writeTo์ ์ฌ๋ฌ ํ๊ฒ์ ํจ๊ป ๋ฃ๋ ๊ฒ(์๋์ ์ผ๋ก ๊ทธ๋ ๊ฒ ํ์๋ ค๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ผ๋ฉด)์ ํผํ์๊ธฐ ๋ฐ๋๋๋ค. ์ฝ์ ํ๊ฒ์ ์ผ์์ ์ผ๋ก ๋นํ์ฑํํ๋ ๊ฒ์ ์ฌ์ฉ์ ์
๋ ฅ์ ๊ธฐ๋ค๋ฆฌ๋ ๋์ ์ฝ์ ํ๋ฉด์ ๊น๋ํ๊ฒ ์ ์งํ๊ธฐ ์ํ ์กฐ์น์
๋๋ค.
ASF๋ ์ฑํ
๋ก๊น
์ ๋ํ ํ์ฅ ์ง์์ ํฌํจํ๊ณ ์์ด, ์์ /๋ฐ์ ๋ ๋ชจ๋ ๋ฉ์์ง๋ฅผ Trace ๋ก๊น
๋ ๋ฒจ์์ ๊ธฐ๋กํ ๋ฟ๋ง ์๋๋ผ, ์ด์ ๊ด๋ จ๋ ์ถ๊ฐ ์ ๋ณด๋ฅผ **์ด๋ฒคํธ ์์ฑ(event properties)**์ผ๋ก๋ ๋
ธ์ถํฉ๋๋ค. ์ด๋ ์ด์ฐจํผ ์ฑํ
๋ฉ์์ง๋ฅผ ๋ช
๋ น์ด๋ก ์ฒ๋ฆฌํด์ผ ํ๊ธฐ ๋๋ฌธ์, ์ด๋ฌํ ์ด๋ฒคํธ๋ฅผ ๋ก๊ทธ๋ก ๊ธฐ๋กํ๋ ๋ฐ ๋ณ๋์ ๋น์ฉ์ด ๋ค์ง ์๊ธฐ ๋๋ฌธ์
๋๋ค. ์ด๋ฅผ ํตํด ์ฌ์ฉ์๋ ์ถ๊ฐ์ ์ธ ๋ก์ง์ ๊ตฌํํ ์ ์์ต๋๋ค(์: ASF๋ฅผ ๋ณธ์ธ๋ง์ ๊ฐ์ธ Steam ์ฑํ
์์นด์ด๋ธ๋ก ๋ง๋๋ ๊ฒ).
| ์ด๋ฆ | ์ค๋ช |
|---|---|
| Echo |
bool ํ์
. ๋ฉ์์ง๊ฐ ์ ํฌ ์ธก์์ ์์ ์์๊ฒ ๋ฐ์ ๋๊ณ ์๋ ๊ฒฝ์ฐ์๋ true๋ก, ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ์๋ false๋ก ์ค์ ๋ฉ๋๋ค. |
| Message |
string ํ์
. ์ด๋ ์ค์ ๋ก ๋ฐ์ /์์ ๋ ๋ฉ์์ง์
๋๋ค. |
| ChatGroupID |
ulong ํ์
. ์ด๋ ๋ฐ์ /์์ ๋ฉ์์ง๊ฐ ์ํ ๊ทธ๋ฃน ์ฑํ
์ ID์
๋๋ค. ์ด ๋ฉ์์ง ์ ์ก์ ๊ทธ๋ฃน ์ฑํ
์ด ์ฌ์ฉ๋์ง ์์ ๊ฒฝ์ฐ์๋ 0์ด ๋ฉ๋๋ค. |
| ChatID |
ulong ํ์
. ์ด๋ ๋ฐ์ /์์ ๋ฉ์์ง๊ฐ ์ํ ChatGroupID ์ฑ๋์ ID์
๋๋ค. ์ด ๋ฉ์์ง ์ ์ก์ ๊ทธ๋ฃน ์ฑํ
์ด ์ฌ์ฉ๋์ง ์์ ๊ฒฝ์ฐ์๋ 0์ด ๋ฉ๋๋ค. |
| SteamID |
ulong ํ์
. ์ด๋ ๋ฐ์ /์์ ๋ฉ์์ง์ ๊ด๋ จ๋ Steam ์ฌ์ฉ์์ ID์
๋๋ค. ํน์ ์ฌ์ฉ์๊ฐ ๋ฉ์์ง ์ ์ก์ ๊ด์ฌํ์ง ์์ ๊ฒฝ์ฐ(์: ์ ํฌ๊ฐ ๊ทธ๋ฃน ์ฑํ
์ผ๋ก ๋ฉ์์ง๋ฅผ ๋ณด๋ด๋ ๊ฒฝ์ฐ)์๋ 0์ด ๋ ์ ์์ต๋๋ค. |
์ด ์์๋ ์์์ ๋ค๋ฃฌ ์ ํฌ์ ColoredConsole ๊ธฐ๋ณธ ์์๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค. ์ดํดํ์๊ธฐ ์ ์, ๋จผ์ NLog ๋ก๊น
์ ๊ธฐ๋ณธ ๊ฐ๋
์ ์ตํ๊ธฐ ์ํด **์ ๋ด์ฉ**์ ๋จผ์ ํ์ธํด๋ณด์๊ธฐ๋ฅผ ๊ฐ๋ ฅํ ๊ถ์ฅ๋๋ฆฝ๋๋ค.
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="ColoredConsole" name="ColoredConsole" />
<target xsi:type="File" name="ChatLogFile" fileName="${currentdir:cached=true}/logs/chat/${event-properties:item=ChatGroupID}-${event-properties:item=ChatID}${when:when='${event-properties:item=ChatGroupID}' == 0:inner=-${event-properties:item=SteamID}}.txt" layout="${date:format=yyyy-MM-dd HH\:mm\:ss} ${event-properties:item=Message} ${when:when='${event-properties:item=Echo}' == true:inner=->:else=<-} ${event-properties:item=SteamID}" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="ColoredConsole" />
<logger name="MainAccount" level="Trace" writeTo="ChatLogFile">
<filters defaultAction="Log">
<when condition="not starts-with('${message}','OnIncoming') and not starts-with('${message}','SendMessage')" action="Ignore" />
</filters>
</logger>
</rules>
</nlog>์ ํฌ๋ ๊ธฐ๋ณธ ColoredConsole ์์์์๋ถํฐ ์์ํ์ฌ, ์ด๋ฅผ ํ์ธต ๋ ํ์ฅํ์ต๋๋ค. ๊ฐ์ฅ ๋จผ์ , ๊ทธ๋ฃน ์ฑ๋๊ณผ Steam ์ฌ์ฉ์๋ณ๋ก ์๊ตฌ์ ์ธ ์ฑํ
๋ก๊ทธ ํ์ผ์ ์ค๋นํ์ต๋๋ค - ์ด๋ ASF๊ฐ ์ ํฌ์๊ฒ ์ธ๋ จ๋ ๋ฐฉ์์ผ๋ก ์ ๊ณตํ๋ ์ถ๊ฐ ์์ฑ ๋๋ถ์ ๊ฐ๋ฅํ ์ผ์
๋๋ค. ๋ํ ํ์ฌ ๋ ์ง, ๋ฉ์์ง ๋ด์ฉ, ๋ฐ์ /์์ ์ ๋ณด, ๊ทธ๋ฆฌ๊ณ Steam ์ฌ์ฉ์ ์์ฒด๋ง์ ๊ธฐ๋กํ๋ ์ปค์คํ
๋ ์ด์์์ ์ฌ์ฉํ๊ธฐ๋ก ๊ฒฐ์ ํ์ต๋๋ค. ๋ง์ง๋ง์ผ๋ก, ์ ํฌ์ ์ฑํ
๋ก๊น
๊ท์น์ ์ค์ง Trace ๋ ๋ฒจ์์๋ง, ์ค์ง MainAccount ๋ด์์๋ง, ๊ทธ๋ฆฌ๊ณ ์ฑํ
๋ก๊น
๊ณผ ๊ด๋ จ๋ ํจ์(๋ฉ์์ง ์์ ๋ฐ ์์ฝ๋ฅผ ์ํ OnIncoming*, ASF ๋ฉ์์ง ๋ฐ์ ์ ์ํ SendMessage*)์์๋ง ํ์ฑํํ์ต๋๋ค.
์ ์์๋ **ArchiBot**๊ณผ ๋ํํ ๋ logs/chat/0-0-76561198069026042.txt ํ์ผ์ ์์ฑํฉ๋๋ค:
2018-07-26 01:38:38 how are you doing? -> 76561198069026042
2018-07-26 01:38:38 I'm doing great, how about you? <- 76561198069026042
๋ฌผ๋ก ์ด๋ ๋จ์ํ ์๋ ์์์ผ ๋ฟ์ด์ง๋ง, ์ค์ฉ์ ์ธ ๋ฐฉ์์ผ๋ก ๋ช ๊ฐ์ง ์ ์ฉํ ๋ ์ด์์ ํ์ฉ ๊ธฐ๋ฒ์ ๋ณด์ฌ๋๋ฆฌ๊ณ ์์ต๋๋ค. ์ด ์์ด๋์ด๋ ์ถ๊ฐ ํํฐ๋ง, ์ฌ์ฉ์ ์ง์ ์์, ๊ฐ์ธ ๋ ์ด์์, ๋ฐ์ ๋ฉ์์ง๋ง ๊ธฐ๋กํ๋ ๊ธฐ๋ฅ ๋ฑ ํ์์ ๋ฐ๋ผ ์ผ๋ง๋ ์ง ํ์ฅํ ์ ์์ต๋๋ค.
์ด ์์๋ SteamTarget์ ์ฌ์ฉํด ๋ฉ์ธ ๋ด์ steamID(76561198006963719)๋ก ๋ฉ์์ง๋ฅผ ๋ณด๋ด๋ฉฐ, ์ด๋ archi๋ผ๋ ์ด๋ฆ์ ๋ด์ด ๊ธฐ๋ถ ๊ฑฐ๋๋ฅผ ๋ฐ์์ ๋ ์คํ๋ฉ๋๋ค. ์ด ๊ณผ์ ์๋ ๋ ๋ค๋ฅธ ๋ด์ด ํ์ํฉ๋๋ค(์๊ธฐ ์์ ์๊ฒ๋ ๋ฉ์์ง๋ฅผ ๋ณด๋ผ ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค).
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target type="Steam" name="Steam" steamID="76561198006963719" />
</targets>
<rules>
<logger name="archi" level="Trace" writeTo="Steam">
<filters defaultAction="Ignore">
<when condition="starts-with('${message}','ParseTrade() Accepted donation trade: ')" action="Log" />
</filters>
</logger>
</rules>
</nlog>์์์ ์ค๋ช
ํ ColoredConsole, File๊ณผ ๊ฐ์ ํ์ค NLog ๋ก๊น
๋์ ์ธ์๋, ์ฌ์ฉ์ ์ง์ ASF ๋ก๊น
๋์์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์์ ์ฑ์ ์ต๋ํํ๊ธฐ ์ํด, ASF Target์ ์ ์๋ NLog ๋ฌธ์ ๊ท์น์ ๋ฐ๋ฆ ๋๋ค.
์ง์ํ์
จ๊ฒ ์ง๋ง, ์ด ๋์์ ASF ๋ฉ์์ง๋ฅผ ๊ธฐ๋กํ๊ธฐ ์ํด Steam ์ฑํ
๋ฉ์์ง๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๊ทธ๋ฃน ์ฑํ
๋๋ ๊ฐ์ธ ์ฑํ
์ค ํ๋๋ฅผ ์ฌ์ฉํ๋๋ก ์ค์ ํ ์ ์์ต๋๋ค. ๋ฉ์์ง์ Steam ๋์์ ์ง์ ํ๋ ๊ฒ ์ธ์๋, ํด๋น ๋ฉ์์ง๋ฅผ ๋ณด๋ผ ๋ด์ botName์ ์ง์ ํ ์ ์์ต๋๋ค.
ASF์์ ์ฌ์ฉ๋๋ ๋ชจ๋ ํ๊ฒฝ์์ ์ง์๋ฉ๋๋ค.
<targets>
<target type="Steam"
name="String"
layout="Layout"
chatGroupID="Ulong"
steamID="Ulong"
botName="Layout" />
</targets>๊ตฌ์ฑ ํ์ผ(Configuration File) ์ฌ์ฉ์ ๋ํด ๋ ์์๋ณด์ธ์.
name - ๋์์ ์ด๋ฆ์ ๋๋ค.
layout - ๋ ๋๋ง๋ ํ
์คํธ์
๋๋ค. Layout ํ์ ํญ๋ชฉ์
๋๋ค. ๊ธฐ๋ณธ๊ฐ: ${level:uppercase=true}|${logger}|${message}
chatGroupID - 64๋นํธ long unsigned integer๋ก ์ ์ธ๋ ๊ทธ๋ฃน ์ฑํ
์ ID์
๋๋ค. ํ์ ํญ๋ชฉ์ด ์๋๋๋ค. ๊ธฐ๋ณธ๊ฐ์ 0์ด๋ฉฐ, ์ด ๊ฒฝ์ฐ ๊ทธ๋ฃน ์ฑํ
๊ธฐ๋ฅ์ด ๋นํ์ฑํ๋๊ณ ๋์ ๊ฐ์ธ ์ฑํ
์ด ์ฌ์ฉ๋ฉ๋๋ค. ํ์ฑํ๋ ๊ฒฝ์ฐ(0์ด ์๋ ๊ฐ์ผ๋ก ์ค์ ๋ ๊ฒฝ์ฐ), ์๋์ steamID ์์ฑ์ chatID๋ก ์๋ํ๋ฉฐ, ๋ด์ด ๋ฉ์์ง๋ฅผ ๋ณด๋ผ ์ด chatGroupID ๋ด ์ฑ๋์ ID๋ฅผ ์ง์ ํฉ๋๋ค.
steamID - 64๋นํธ long unsigned integer๋ก ์ ์ธ๋ ๋์ Steam ์ฌ์ฉ์์ SteamID(์: SteamOwnerID) ๋๋ chatGroupID๊ฐ ์ค์ ๋ ๊ฒฝ์ฐ ๋์ chatID์
๋๋ค. ํ์ ํญ๋ชฉ์
๋๋ค. ๊ธฐ๋ณธ๊ฐ์ 0์ด๋ฉฐ, ์ด ๊ฒฝ์ฐ ๋ก๊น
๋์์ด ์์ ํ ๋นํ์ฑํ๋ฉ๋๋ค.
botName - ์์์ ์ ์ธํ steamID๋ก ๋ฉ์์ง๋ฅผ ๋ณด๋ผ ๋ด์ ์ด๋ฆ์
๋๋ค(ASF๊ฐ ์ธ์ํ๋ ์ด๋ฆ์ผ๋ก, ๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํฉ๋๋ค). ํ์ ํญ๋ชฉ์ด ์๋๋๋ค. ๊ธฐ๋ณธ๊ฐ์ null์ด๋ฉฐ, ์ด ๊ฒฝ์ฐ ํ์ฌ ์ฐ๊ฒฐ๋ ๋ด ์ค **์์์ ๋ด(any)**์ด ์๋์ผ๋ก ์ ํ๋ฉ๋๋ค. SteamTarget์ ๋์์ steamID๊ฐ ์น๊ตฌ ๋ชฉ๋ก์ ์์ด์ผ ํ๋ค๋ ๋ฑ ์ฌ๋ฌ Steam ์ ํ ์ฌํญ์ ๊ณ ๋ คํ์ง ์์ผ๋ฏ๋ก, ์ด ๊ฐ์ ์ ์ ํ ์ค์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ์ด ๋ณ์๋ layout ํ์
์ผ๋ก ์ ์๋์ด ์์ผ๋ฏ๋ก, ๋ฉ์์ง๋ฅผ ์์ฑํ ๋ด์ ์ฌ์ฉํ๊ธฐ ์ํ ${logger}์ ๊ฐ์ ํน์ ๊ตฌ๋ฌธ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
MyBot์ด๋ผ๋ ์ด๋ฆ์ ๋ด์์ ๋ฐ์ํ Debug ๋ ๋ฒจ ์ด์์ ๋ชจ๋ ๋ฉ์์ง๋ฅผ steamID 76561198006963719๋ก ์ ์กํ๋ ค๋ฉด, ์๋์ ์ ์ฌํ NLog.config๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="https://nlog-project.org/schemas/NLog.xsd" xsi:schemaLocation="NLog NLog.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<targets>
<target type="Steam" name="Steam" steamID="76561198006963719" botName="MyBot" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="Steam" />
</rules>
</nlog>์ฐธ๊ณ : SteamTarget์ ์ฌ์ฉ์ ์ง์ ๋์์ด๋ฏ๋ก, xsi:type="Steam"์ด ์๋๋ผ type="Steam"์ผ๋ก ์ ์ธํด์ผ ํฉ๋๋ค. xsi๋ NLog๊ฐ ๊ณต์์ ์ผ๋ก ์ง์ํ๋ ๋์์ ์ํด ์์ฝ๋์ด ์์ต๋๋ค.
์์ ์ ์ฌํ NLog.config๋ก ASF๋ฅผ ์คํํ๋ฉด, MyBot์ด ๋ชจ๋ ์ผ๋ฐ์ ์ธ ASF ๋ก๊ทธ ๋ฉ์์ง๋ฅผ Steam ์ฌ์ฉ์ 76561198006963719์๊ฒ ์ ์กํ๊ธฐ ์์ํฉ๋๋ค. ๋ฉ์์ง๋ฅผ ๋ณด๋ด๋ ค๋ฉด MyBot์ด ์ฐ๊ฒฐ๋์ด ์์ด์ผ ํ๋ฏ๋ก, ๋ด์ด Steam ๋คํธ์ํฌ์ ์ฐ๊ฒฐ๋๊ธฐ ์ ์ ๋ฐ์ํ ์ด๊ธฐ ASF ๋ฉ์์ง๋ ์ ๋ฌ๋์ง ์๋๋ค๋ ์ ์ ์ ์ํ์ธ์.
๋ฌผ๋ก SteamTarget์ ์ผ๋ฐ์ ์ธ TargetWithLayout์์ ๊ธฐ๋ํ ์ ์๋ ๋ชจ๋ ์ ํ์ ์ธ ๊ธฐ๋ฅ์ ๊ฐ์ถ๊ณ ์์ผ๋ฏ๋ก, ์ฌ์ฉ์ ์ง์ ๋ ์ด์์, ์ด๋ฆ, ๊ณ ๊ธ ๋ก๊น
๊ท์น ๋ฑ๊ณผ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ ์์๋ ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ธ ์์์ผ ๋ฟ์
๋๋ค.
ASF ํ๋ก์ธ์ค์ ์ฐธ์ฌ ์ค์ธ steamID์ ํจ๊ป SteamTarget์์ Debug ๋ก๊น
๋ ๋ฒจ ์ดํ๋ฅผ ๊ฒฐํฉํ๋ ค๋ ๊ฒฝ์ฐ ์ฃผ์ํ์ธ์. ์ด ๊ฒฝ์ฐ ASF๊ฐ ํน์ ๋ฉ์์ง๋ฅผ ์์ ํ ๋ค ์ด๋ฅผ Steam์ ํตํด ๊ธฐ๋กํ๊ณ , ๊ทธ๋ก ์ธํด ๋ค์ ๊ธฐ๋กํด์ผ ํ ๋ฉ์์ง๊ฐ ์์ฑ๋๋ ๋ฌดํ ๋ฃจํ๊ฐ ๋ฐ์ํ์ฌ StackOverflowException์ด ๋ฐ์ํ ์ ์์ต๋๋ค. ํ์ฌ ์ด๋ฌํ ์ํฉ์ด ๋ฐ์ํ ์ ์๋ ์ ์ผํ ๊ฒฝ์ฐ๋ Trace ๋ ๋ฒจ(ASF๊ฐ ์์ฒด ์ฑํ
๋ฉ์์ง๋ฅผ ๊ธฐ๋กํ๋ ๊ฒฝ์ฐ)์ ๊ธฐ๋กํ๊ฑฐ๋, ASF๋ฅผ Debug ๋ชจ๋๋ก ์คํํ๋ ๋์ Debug ๋ ๋ฒจ(ASF๊ฐ ๋ชจ๋ Steam ํจํท์ ๊ธฐ๋กํ๋ ๊ฒฝ์ฐ)์ ๊ธฐ๋กํ๋ ๊ฒฝ์ฐ์
๋๋ค.
์์ฝํ๋ฉด, steamID๊ฐ ๋์ผํ ASF ํ๋ก์ธ์ค์ ์ฐธ์ฌํ๊ณ ์๋ ๊ฒฝ์ฐ, SteamTarget์ minlevel ๋ก๊น
๋ ๋ฒจ์ Info(ASF๋ฅผ Debug ๋ชจ๋๋ก ์คํํ์ง ์๋๋ค๋ฉด Debug๋ ๊ฐ๋ฅ) ์ด์์ด์ด์ผ ํฉ๋๋ค. ๋ ๋ฒจ์ ์์ ํ๋ ๊ฒ์ด ์ํฉ์ ๋ง์ง ์๋๋ค๋ฉด, ๋ฌดํ ๋ก๊น
๋ฃจํ๋ฅผ ํผํ๊ธฐ ์ํด ์์ฒด <when> ๋ก๊น
ํํฐ๋ฅผ ์ ์ํ ์๋ ์์ต๋๋ค. ์ด ์ฃผ์ ์ฌํญ์ ๊ทธ๋ฃน ์ฑํ
์๋ ์ ์ฉ๋ฉ๋๋ค.
์ด ๋์์ **ASF API**์ /Api/NLog ์๋ํฌ์ธํธ์์ ๊ณ ์ ํฌ๊ธฐ์ ๋ก๊น
๊ธฐ๋ก(history)์ ์ ๊ณตํ๊ธฐ ์ํด ASF ๋ด๋ถ์ ์ผ๋ก ์ฌ์ฉ๋๋ฉฐ, ์ดํ ASF-ui ๋ฐ ๊ธฐํ ๋๊ตฌ์์ ์ด๋ฅผ ํ์ฉํ ์ ์์ต๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ์ด ๋์์ ๋ค๋ฅธ ์ฌ์ฉ์ ์ง์ ์ ์ํด ์ด๋ฏธ ์ปค์คํ
NLog config๋ฅผ ์ฌ์ฉ ์ค์ด๊ณ , ASF API(์: ASF-ui)์ ๋ก๊ทธ๋ฅผ ๋
ธ์ถํ๊ณ ์ ํ ๋๋ง ์ ์ํ๋ฉด ๋ฉ๋๋ค. ์ ์ฅ๋ ๋ฉ์์ง์ ๊ธฐ๋ณธ ๋ ์ด์์์ด๋ maxCount๋ฅผ ์์ ํ๊ณ ์ถ์ ๋๋ ์ ์ธํ ์ ์์ต๋๋ค.
ASF์์ ์ฌ์ฉ๋๋ ๋ชจ๋ ํ๊ฒฝ์์ ์ง์๋ฉ๋๋ค.
<targets>
<target type="History"
name="String"
layout="Layout"
maxCount="Byte" />
</targets>๊ตฌ์ฑ ํ์ผ(Configuration File) ์ฌ์ฉ์ ๋ํด ๋ ์์๋ณด์ธ์.
name - ๋์์ ์ด๋ฆ์ ๋๋ค.
layout - ๋ ๋๋ง๋ ํ
์คํธ์
๋๋ค. Layout ํ์ ํญ๋ชฉ์
๋๋ค. ๊ธฐ๋ณธ๊ฐ: ${date:format=yyyy-MM-dd HH\:mm\:ss}|${processname}-${processid}|${level:uppercase=true}|${logger}|${message}${onexception:inner= ${exception:format=toString,Data}}
maxCount - ์จ๋๋งจ๋ ๊ธฐ๋ก(on-demand history)์ ์ํด ์ ์ฅ๋๋ ๋ก๊ทธ์ ์ต๋ ๊ฐ์์
๋๋ค. ํ์ ํญ๋ชฉ์ด ์๋๋๋ค. ๊ธฐ๋ณธ๊ฐ์ 20์ด๋ฉฐ, ์ด๋ ์ด๊ธฐ ๊ธฐ๋ก์ ์ ๊ณตํ๋ฉด์๋ ์ ์ฅ ์๊ตฌ์ฌํญ์ ๋ฐ๋ฅธ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ ๊ณ ๋ คํ์ ๋ ์ ์ ํ ๊ท ํ์ ์
๋๋ค. 0๋ณด๋ค ์ปค์ผ ํฉ๋๋ค.
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|
- ๐ก ํ
- ๐ฌ ์์ฃผ ๋ฌป๋ ์ง๋ฌธ
- โ๏ธ ์์ํ๊ธฐ (์ฌ๊ธฐ์๋ถํฐ)
- ๐ฅ ๋ฐฑ๊ทธ๋ผ์ด๋ ๊ฒ์ ๋ฑ๋ก๊ธฐ
- ๐ข ๋ช ๋ น์ด
- ๐ ๏ธํธํ์ฑ
- ๐ง ํ๊ฒฝ์ค์
- ๐ด ItemsMatcherPlugin
- ๐ ๊ด๋ฆฌ
- โฑ๏ธ ์ฑ๋ฅ
- ๐ก ์๊ฒฉ ํต์
- ๐ช Steam ๊ฐ์กฑ ๊ณต์
- ๐ ๊ฑฐ๋
- โจ๏ธ ๋ช ๋ น์ค ์ธ์
- ๐ง ์ฌ์ฉ ์ค๋จ
- ๐ณ Docker
- ๐ค ์ถ๊ฐ ์์ฃผ ๋ฌป๋ ์ง๋ฌธ
- ๐ ๊ณ ์ฑ๋ฅ ์ค์
- ๐ IPC
- ๐ ํ์งํ
- ๐ ๋ก๊น
- ๐พ ์ ์ฌ์ ๋ฉ๋ชจ๋ฆฌ ํ๊ฒฝ ์ค์
- ๐ต๐ผโโ๏ธ MonitoringPlugin
- ๐ ํ๋ฌ๊ทธ์ธ
- ๐ ๋ณด์
- โฌ๏ธ SteamTokenDumperPlugin
- ๐ฆ ์๋ ํํฐ
- ๐ต 2๋จ๊ณ ์ธ์ฆ








