{"id":26263,"date":"2014-06-09T07:00:58","date_gmt":"2014-06-09T04:00:58","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=26263"},"modified":"2014-06-06T13:48:49","modified_gmt":"2014-06-06T10:48:49","slug":"springhibernate-improved-sql-logging-with-log4jdbc","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html","title":{"rendered":"Spring\/Hibernate improved SQL logging with log4jdbc"},"content":{"rendered":"<p>Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database.<\/p>\n<p>It also does not log the execution time of each query, which is useful for performance troubleshooting. This blog post will go over how to setup Hibernate query logging, and then compare it to the logging that can be obtained with <a href=\"https:\/\/code.google.com\/p\/log4jdbc-remix\/\">log4jdbc<\/a>.<\/p>\n<h3>The Hibernate query logging functionality<\/h3>\n<p>Hibernate does not log the real SQL queries sent to the database. This is because Hibernate interacts with the database via the JDBC driver, to which it sends prepared statements but not the actual queries.<\/p>\n<p>So Hibernate can only log the prepared statements and the values of their binding parameters, but not the actual SQL queries themselves.<\/p>\n<p>This is how a query looks like when logged by Hibernate:<\/p>\n<pre class=\" brush:sql\">select \/* load your.package.Employee *\/ this_.code, ... \r\nfrom employee this_ \r\nwhere this_.employee_id=?\r\n\r\nTRACE 12-04-2014@16:06:02  BasicBinder - binding parameter [1] as [NUMBER] - 1000<\/pre>\n<p>See this post <a href=\"http:\/\/blog.jhades.org\/how-to-find-out-why-hibernate-is-doing-a-certain-sql-query\">Why and where is Hibernate doing this SQL query?<\/a> for how to setup this type of logging.<\/p>\n<h2>Using log4jdbc<\/h2>\n<p>For a developer it&#8217;s useful to be able to copy paste a query from the log and be able to execute the query directly in an SQL client, but the variable placeholders <code>?<\/code> make that unfeasible.<\/p>\n<p>Log4jdbc in an open source tool that allows to do just that, and more. Log4jdbc is a spy driver that will wrap itself around the real JDBC driver, logging queries as they go through it.<\/p>\n<p>The version linked from this post provides Spring integration, unlike several other log4jdbc forks.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3>Setting up log4jdbc<\/h3>\n<p>First include the log4jdbc-remix library in your pom.xml. This library is a fork of the original log4jdbc:<\/p>\n<pre class=\" brush:xml\">&lt;dependency&gt;\r\n    &lt;groupId&gt;org.lazyluke&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;log4jdbc-remix&lt;\/artifactId\r\n    &lt;version&gt;0.2.7&lt;\/version&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<p>Next, find in the Spring configuration the definition of the data source. As an example, when using the JNDI lookup element this is how the data source looks like:<\/p>\n<pre class=\" brush:xml\">&lt;jee:jndi-lookup id=\"dataSource\" \r\n    jndi-name=\"java:comp\/env\/jdbc\/some-db\" \/&gt;<\/pre>\n<p>After finding the data source definition, rename it to the following name:<\/p>\n<pre class=\" brush:xml\">&lt;jee:jndi-lookup id=\"dataSourceSpied\" \r\n    jndi-name=\"java:comp\/env\/jdbc\/some-db\" \/&gt;<\/pre>\n<p>Then define a new log4jdbc data source that wraps the real data source, and give it the original name:<\/p>\n<pre class=\" brush:xml\">&lt;bean id=\"dataSource\" class=\"net.sf.log4jdbc.Log4jdbcProxyDataSource\" &gt;         \r\n     &lt;constructor-arg ref=\"dataSourceSpied\" \/&gt;         \r\n     &lt;property name=\"logFormatter\"&gt;                    \r\n         &lt;bean class=\"net.sf.log4jdbc.tools.Log4JdbcCustomFormatter\" &gt;\r\n             &lt;property name=\"loggingType\" value=\"SINGLE_LINE\" \/&gt;\r\n             &lt;property name=\"margin\" value=\"19\" \/&gt;   \r\n             &lt;property name=\"sqlPrefix\" value=\"SQL:::\" \/&gt;            \r\n         &lt;\/bean&gt;            \r\n     &lt;\/property&gt;     \r\n&lt;\/bean &gt;<\/pre>\n<p>With this configuration, the query logging should already be working. It&#8217;s possible to customize the logging level of the several log4jdbc loggers available.<\/p>\n<p>The original <a href=\"https:\/\/code.google.com\/p\/log4jdbc\/\">log4jdbc<\/a> documentation provides more information on the available loggers:<\/p>\n<ul>\n<li><code>jdbc.sqlonly<\/code>: Logs only SQL<\/li>\n<li><code>jdbc.sqltiming<\/code>: Logs the SQL, post-execution, including timing execution statistics<\/li>\n<li><code>jdbc.audit<\/code>: Logs ALL JDBC calls except for ResultSets<\/li>\n<li><code>jdbc.resultset<\/code>: all calls to ResultSet objects are logged<\/li>\n<li><code>jdbc.connection<\/code>: Logs connection open and close events<\/li>\n<\/ul>\n<p>The <code>jdbc.audit<\/code> logger is especially useful to validate the scope of transactions, as it logs the begin\/commit\/rollback events of a database transaction.<\/p>\n<p>This is the proposed log4j configuration that will print only the SQL queries together with their execution time:<\/p>\n<pre class=\" brush:xml\">&lt;logger name=\"jdbc.sqltiming\" additivity =\"false\"&gt;             \r\n     &lt;level value=\"info\" \/&gt;                \r\n &lt;\/logger&gt;  \r\n &lt;logger name=\"jdbc.resultset\" additivity =\"false\"&gt;              \r\n     &lt;level value=\"error\" \/&gt;        \r\n &lt;\/logger&gt;  \r\n &lt;logger name=\"jdbc.audit\" additivity =\"false\"&gt;\r\n     &lt;level value=\"error\" \/&gt;        \r\n &lt;\/logger&gt;   \r\n &lt;logger name=\"jdbc.sqlonly\" additivity =\"false\"&gt;              \r\n     &lt;level value=\"error\" \/&gt;        \r\n &lt;\/logger&gt;   \r\n &lt;logger name=\"jdbc.resultsettable\" additivity =\"false\"&gt;           \r\n     &lt;level value=\"error\" \/&gt;       \r\n &lt;\/logger&gt;           \r\n &lt;logger name=\"jdbc.connection\" additivity =\"false\"&gt;              \r\n     &lt;level value=\"error\" \/&gt;        \r\n &lt;\/logger&gt;  \r\n &lt;logger name=\"jdbc.resultsettable\" additivity =\"false\"&gt;            \r\n     &lt;level value=\"error\" \/&gt;        \r\n &lt;\/logger&gt;<\/pre>\n<h2>Conclusion<\/h2>\n<p>Using log4jdbc does simply some initial setup, but once it&#8217;s in place it&#8217;s really convenient to have. Having a true query log is also useful for performance troubleshooting, as will be described in an upcoming post.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/blog.jhades.org\/logging-the-actualreal-sql-queries-of-a-springhibernate-application\/\">Spring\/Hibernate improved SQL logging with log4jdbc<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\">JCG partner<\/a> Aleksey Novik at the <a href=\"http:\/\/blog.jhades.org\/\">The JHades Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database. It also does not log the execution time of each query, which is useful for performance troubleshooting. This blog post will go over how to setup Hibernate query logging, and &hellip;<\/p>\n","protected":false},"author":568,"featured_media":153,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[31,30],"class_list":["post-26263","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jboss-hibernate","tag-spring"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring\/Hibernate improved SQL logging with log4jdbc<\/title>\n<meta name=\"description\" content=\"Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database. It\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring\/Hibernate improved SQL logging with log4jdbc\" \/>\n<meta property=\"og:description\" content=\"Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database. It\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-09T04:00:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Aleksey Novik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/JhadesDev\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Aleksey Novik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html\"},\"author\":{\"name\":\"Aleksey Novik\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/7d67bcfba8c4c2dc66f64696fd43a7c6\"},\"headline\":\"Spring\\\/Hibernate improved SQL logging with log4jdbc\",\"datePublished\":\"2014-06-09T04:00:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html\"},\"wordCount\":516,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jboss-hibernate-logo.jpg\",\"keywords\":[\"JBoss Hibernate\",\"Spring\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html\",\"name\":\"Spring\\\/Hibernate improved SQL logging with log4jdbc\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jboss-hibernate-logo.jpg\",\"datePublished\":\"2014-06-09T04:00:58+00:00\",\"description\":\"Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database. It\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jboss-hibernate-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jboss-hibernate-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/06\\\/springhibernate-improved-sql-logging-with-log4jdbc.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring\\\/Hibernate improved SQL logging with log4jdbc\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/7d67bcfba8c4c2dc66f64696fd43a7c6\",\"name\":\"Aleksey Novik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fdd3c156085cc7c72b32afe338e88a3a3c4979223e6a66abc62a37f99eb65056?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fdd3c156085cc7c72b32afe338e88a3a3c4979223e6a66abc62a37f99eb65056?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fdd3c156085cc7c72b32afe338e88a3a3c4979223e6a66abc62a37f99eb65056?s=96&d=mm&r=g\",\"caption\":\"Aleksey Novik\"},\"description\":\"Software developer, Likes to learn new technologies, hang out on stackoverflow and blog on tips and tricks on Java\\\/Javascript polyglot enterprise development.\",\"sameAs\":[\"http:\\\/\\\/blog.jhades.org\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/JhadesDev\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/aleksey-novik\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring\/Hibernate improved SQL logging with log4jdbc","description":"Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database. It","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html","og_locale":"en_US","og_type":"article","og_title":"Spring\/Hibernate improved SQL logging with log4jdbc","og_description":"Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database. It","og_url":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-06-09T04:00:58+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","type":"image\/jpeg"}],"author":"Aleksey Novik","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/JhadesDev","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Aleksey Novik","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html"},"author":{"name":"Aleksey Novik","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/7d67bcfba8c4c2dc66f64696fd43a7c6"},"headline":"Spring\/Hibernate improved SQL logging with log4jdbc","datePublished":"2014-06-09T04:00:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html"},"wordCount":516,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","keywords":["JBoss Hibernate","Spring"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html","url":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html","name":"Spring\/Hibernate improved SQL logging with log4jdbc","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","datePublished":"2014-06-09T04:00:58+00:00","description":"Hibernate provides SQL logging out of the box, but such logging only shows prepared statements, and not the actual SQL queries sent to the database. It","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2014\/06\/springhibernate-improved-sql-logging-with-log4jdbc.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring\/Hibernate improved SQL logging with log4jdbc"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/7d67bcfba8c4c2dc66f64696fd43a7c6","name":"Aleksey Novik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fdd3c156085cc7c72b32afe338e88a3a3c4979223e6a66abc62a37f99eb65056?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/fdd3c156085cc7c72b32afe338e88a3a3c4979223e6a66abc62a37f99eb65056?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fdd3c156085cc7c72b32afe338e88a3a3c4979223e6a66abc62a37f99eb65056?s=96&d=mm&r=g","caption":"Aleksey Novik"},"description":"Software developer, Likes to learn new technologies, hang out on stackoverflow and blog on tips and tricks on Java\/Javascript polyglot enterprise development.","sameAs":["http:\/\/blog.jhades.org\/","https:\/\/x.com\/https:\/\/twitter.com\/JhadesDev"],"url":"https:\/\/www.javacodegeeks.com\/author\/aleksey-novik"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/26263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/568"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=26263"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/26263\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/153"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=26263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=26263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=26263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}