208 words

Show Sql/Jpql

#1
2013-02-28 09:23

Is there a way to show the executed Sql/Jpql in the console?

PG
PG's picture
Joined on 2012-06-28
User Post #7
#2
2013-02-28 09:25

You can set the log element in ObjectDB configuration to write logging also to the console:

    <log path="$objectdb/log/" max="8mb" stdout="true" stderr="false" />

When stdout is set to true, all the logging information is written to the console, in addition to being written to the log file. Currently you cannot send only selective information from the log to the console.

To write query execution to the log, add the following logger element to the configuration:

    <logger name="query.manager" level="debug" />
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,434
#3
2013-02-28 13:12

I know that, but is there a possibility to see it in Sql/Jpql style not xml. I can only see select statements, but I also want to see insert, update and delete

PG
PG's picture
Joined on 2012-06-28
User Post #8
#4
2013-02-28 15:15

It may be a good idea to log queries as strings in TRACE logging level.

ObjectDB (unlike ORM JPA implementation) does not use queries to implement Insert, Update and Delete operations (except delete/update queries). You may log these operations by setting a JPA lifecycle listener or callback.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,435
#5
2013-03-11 01:10

Build 2.4.7_01 adds simple text logging of query execution.

It could be enabled by setting the following logger in the configuration file:

    <logger name="query.manager" level="trace" />
  </general>

This will generate logging lines, such as:

Query "SELECT e FROM MyEntity e" => 100 results in 1 milliseconds.
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,441

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel