Skip to content

GreenRover/hibernate-log-analyser

Repository files navigation

Hibernate LOG analyser

Debug von raw SQL generated by Hibernate.
Reintegrate the bind values for debug querys directly to an SQL Console.
Find where in code a query was fired, by using debug log entrys.

s-01

Usage

A dialog box is shown by pressing Ctrl + Alt + P search for command Extract SQL from Hibernate log.
Or by pressing Alt + H keys (Alt and H)
It will parse the current open hibernate log file and show the raw sql in new editor.

Debug markers in code

You can put debug marker in your code.

LOG.error("#### my debug info");

Those have to start with at least 4 #. do be shown in the output.

Setup

Activate hibernate logging in log4j.xml

 <logger name="org.hibernate.type">
    <level value="trace>
 </logger>
 <logger name="org.hibernate.SQL">
    <level value="trace"/>
 </logger>

Force hibernate to log querys:

 configurationRegistry.setProperty("hibernate.show_sql", "true");

Further informations can be found at: "Hibernate show real SQL"
I would advice to use additionaly this extension Monitor file to monitor log files for changes.

Limitation

Caused by this issue this extension is limited to a maximum log file size of 5MB You can patch your vs code installation. Change in

"%programfiles(x86)%\Microsoft VS Code\resources\app\out\vs\code\electron-main\main.js"
or for x64 edition
"%programfiles%\Microsoft VS Code\resources\app\out\vs\workbench\workbench.main.js"

Following code and add 00. To Increase Limit from 5MB to 500MB

MODEL_SYNC_LIMIT=5242880,

Or you filter your with log4j.xml to reduce file size

<filter class="org.apache.log4j.varia.StringMatchFilter">
  <param name="StringToMatch" value="extracted value"/>
  <param name="AcceptOnMatch" value="false"/>
</filter>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published