{"id":2436,"date":"2024-11-01T09:03:07","date_gmt":"2024-11-01T00:03:07","guid":{"rendered":"http:\/\/blog.moramcnt.com\/?p=2436"},"modified":"2024-11-01T09:03:07","modified_gmt":"2024-11-01T00:03:07","slug":"log4jdbc2%eb%a5%bc-%ec%82%ac%ec%9a%a9%ed%95%98%ec%97%ac-%eb%a1%9c%ea%b7%b8%ec%84%a4%ec%a0%95","status":"publish","type":"post","link":"http:\/\/blog.moramcnt.com\/?p=2436","title":{"rendered":"Log4jdbc2\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub85c\uadf8\uc124\uc815"},"content":{"rendered":"<p><strong>I. \ubaa9\ud45c<\/strong><\/p>\n<p>\uae30\uc874\uc5d0 SQL\ubb38\uc7a5\ub4f1\uc744 \ub85c\uadf8\ub85c \ucd9c\ub825\ud558\uc5ec \ubcf4\uba74 \uac1c\ud589\ub3c4 \uc5c6\uc774 \ud55c\uc904\uc5d0 \ub098\uc624\ub294\ub4f1\uc758 \ubcf4\uae30\uc5d0 \ubd88\ud3b8\ud55c \uc810\uc774 \ub9ce\uc544, \uc774\ub97c \uac1c\uc120\ud558\uace0\uc790 Log4jdbc2\ub97c \uc124\uc815\ud558\uae30\ub85c \ud558\uc600\ub2e4.<\/p>\n<p><strong>II. \uac1c\ubc1c\ubc0f \uc5f0\uad6c\ub0b4\uc6a9<\/strong><\/p>\n<p>1. pom.xml \uc5d0 \uc544\ub798\uc640 \uac19\uc774 \ucd94\uac00<\/p>\n<table style=\"width: 100%; border-style: solid; border-color: #eeeeee; background-color: #ebebeb;\" border=\"1\">\n<tbody>\n<tr>\n<td>&lt;dependency&gt;<\/p>\n<p>&lt;groupId&gt;org.bgee.log4jdbc-log4j2&lt;\/groupId&gt;<\/p>\n<p>&lt;artifactId&gt;log4jdbc-log4j2-jdbc4.1&lt;\/artifactId&gt;<\/p>\n<p>&lt;version&gt;1.16&lt;\/version&gt;<\/p>\n<p>&lt;\/dependency&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>2. Globals.properties \ud30c\uc77c \uc218\uc815<\/p>\n<table style=\"width: 100%; border-style: solid; border-color: #eeeeee; background-color: #ebebeb;\">\n<tbody>\n<tr>\n<td>Globals.DriverClassName=oracle.jdbc.driver.OracleDriver<\/p>\n<p>Globals.Url=jdbc:oracle:thin:@localhost:1521:TESTDB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\uc704\uc640 \uac19\uc774 \ubd80\ubd84\uc744 \ucc3e\uc544 \uc544\ub798\ucc98\ub7fc \uc218\uc815<\/p>\n<table style=\"width: 100%; border-style: solid; border-color: #eeeeee; background-color: #ebebeb;\">\n<tbody>\n<tr>\n<td>Globals.DriverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy<\/p>\n<p>Globals.Url=<b>jdbc:log4jdbc<\/b>:oracle:thin:@localhost:1521\/TESTDB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>3. log4jdbc.log4j2.properties \uc0dd\uc131<\/p>\n<table style=\"width: 100%; border-style: solid; border-color: #eeeeee; background-color: #ebebeb;\">\n<tbody>\n<tr>\n<td>log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator<\/p>\n<p>log4jdbc.dump.sql.maxlinelength=0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>4. \ub85c\uadf8\ud30c\uc77c \uc124\uc815 : log4j2.xml<\/p>\n<table style=\"width: 100%; border-style: solid; border-color: #eeeeee; background-color: #ebebeb;\">\n<tbody>\n<tr>\n<td>&lt;logger name=&#8221;jdbc.resultset&#8221; level=&#8221;OFF&#8221; additivity=&#8221;false&#8221;&gt;&lt;AppenderRef ref=&#8221;console&#8221;\/&gt;&lt;\/logger&gt;<\/p>\n<p>&lt;logger name=&#8221;jdbc.resultsettable&#8221; level=&#8221;${logLevel}&#8221; additivity=&#8221;false&#8221;&gt;&lt;AppenderRef ref=&#8221;console&#8221;\/&gt;&lt;AppenderRef ref=&#8221;appRollingFile&#8221;\/&gt;&lt;\/logger&gt;<\/p>\n<p>&lt;logger name=&#8221;jdbc.sqltiming&#8221; level=&#8221;OFF&#8221; additivity=&#8221;false&#8221;&gt;&lt;AppenderRef ref=&#8221;console&#8221;\/&gt;&lt;\/logger&gt;<\/p>\n<p>&lt;logger name=&#8221;jdbc.sqlonly&#8221; level=&#8221;${logLevel}&#8221; additivity=&#8221;false&#8221;&gt;&lt;AppenderRef ref=&#8221;console&#8221;\/&gt;&lt;AppenderRef ref=&#8221;appRollingFile&#8221; \/&gt;&lt;\/logger&gt;<\/p>\n<p>&lt;logger name=&#8221;jdbc.audit&#8221; level=&#8221;OFF&#8221; additivity=&#8221;false&#8221;&gt;&lt;AppenderRef ref=&#8221;appRollingFile&#8221; \/&gt;&lt;\/logger&gt;<\/p>\n<p>&lt;logger name=&#8221;org.mybatis&#8221; level=&#8221;OFF&#8221; additivity=&#8221;false&#8221;&gt;&lt;AppenderRef ref=&#8221;appRollingFile&#8221; \/&gt;&lt;\/logger&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>III. \uacb0\ub860<\/p>\n<p>\uc544\ub798\uc640 \uac19\uc774 Mybatis\uc5d0 \uc788\ub294 SQL\ubb38\uc7a5\uc774 \uc798 \ucd9c\ub825\ub418\uc5c8\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-2437\" src=\"http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/11\/\ub85c\uadf8-300x59.png\" alt=\"\" width=\"636\" height=\"125\" srcset=\"http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/11\/\ub85c\uadf8-300x59.png 300w, http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/11\/\ub85c\uadf8-1024x200.png 1024w, http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/11\/\ub85c\uadf8-768x150.png 768w, http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/11\/\ub85c\uadf8-1536x300.png 1536w, http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2024\/11\/\ub85c\uadf8.png 1904w\" sizes=\"auto, (max-width: 636px) 100vw, 636px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I. \ubaa9\ud45c \uae30\uc874\uc5d0 SQL\ubb38\uc7a5\ub4f1\uc744 \ub85c\uadf8\ub85c \ucd9c\ub825\ud558\uc5ec \ubcf4\uba74 \uac1c\ud589\ub3c4 \uc5c6\uc774 \ud55c\uc904\uc5d0 \ub098\uc624\ub294\ub4f1\uc758 \ubcf4\uae30\uc5d0 \ubd88\ud3b8\ud55c \uc810\uc774 \ub9ce\uc544, \uc774\ub97c \uac1c\uc120\ud558\uace0\uc790 Log4jdbc2\ub97c \uc124\uc815\ud558\uae30\ub85c \ud558\uc600\ub2e4. II. \uac1c\ubc1c\ubc0f \uc5f0\uad6c\ub0b4\uc6a9 1. pom.xml \uc5d0 \uc544\ub798\uc640 \uac19\uc774 \ucd94\uac00 &lt;dependency&gt; &lt;groupId&gt;org.bgee.log4jdbc-log4j2&lt;\/groupId&gt; &lt;artifactId&gt;log4jdbc-log4j2-jdbc4.1&lt;\/artifactId&gt; &lt;version&gt;1.16&lt;\/version&gt; &lt;\/dependency&gt; &nbsp; 2. Globals.properties \ud30c\uc77c \uc218\uc815 Globals.DriverClassName=oracle.jdbc.driver.OracleDriver Globals.Url=jdbc:oracle:thin:@localhost:1521:TESTDB \uc704\uc640 \uac19\uc774 \ubd80\ubd84\uc744 \ucc3e\uc544 \uc544\ub798\ucc98\ub7fc \uc218\uc815 Globals.DriverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy Globals.Url=jdbc:log4jdbc:oracle:thin:@localhost:1521\/TESTDB &nbsp; &nbsp; 3. log4jdbc.log4j2.properties \uc0dd\uc131 log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[6,7],"tags":[313,315,314],"class_list":["post-2436","post","type-post","status-publish","format-standard","hentry","category-java","category-7","tag-log4jdbc2","tag-315","tag-314"],"_links":{"self":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2436"}],"version-history":[{"count":2,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2436\/revisions"}],"predecessor-version":[{"id":2439,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/2436\/revisions\/2439"}],"wp:attachment":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2436"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}