ORM log- where and how?

This is probably something really stupid that I’m missing. I have ORM
logging turned on in the server admin, “log SQL”:

http://127.0.0.1:8888/lucee/admin/server.cfm?action=services.orm

I am looking here:

C:\lucee\tomcat\logs - tomcat logs, no orm.log
C:\lucee\tomcat\webapps\ROOT\WEB-INF\lucee\logs - orm.log empty
C:\git\thesiteinquestion.com\trunk\WEB-INF\lucee\logs - orm.log empty

But the orm.log seems to be empty no matter what I do. Where SHOULD it be-
in the WEB-INF for the specific site?

I have checked the Application.cfc for the app in question and set

this.ormsettings.logsql=“true”;

Any idea what I might be doing wrong here? I want to see exactly what SQL
it is producing to debug an error I’m getting on what should be an INSERT:

org.hibernate.StaleStateException
Batch update returned unexpected row count from update [0]; actual row
count: 0; expected: 1

Version Lucee 4.5.2.018 final
OS Windows 10 (10.0) 64bit
Servlet Container Apache Tomcat/8.0.28
Java 1.8.0_66 (Oracle Corporation) 64bit

Try looking here:

[luceeroot]/tomcat/logs/lucee-stdout.DATE.log

Not very obvious I agree and I keep forgetting. Should really be in the orm.log.On 6 July 2016 at 11:47, Ivan McAvinchey <@Ivan_McAvinchey> wrote:

This is probably something really stupid that I’m missing. I have ORM
logging turned on in the server admin, “log SQL”:

http://127.0.0.1:8888/lucee/admin/server.cfm?action=services.orm

I am looking here:

C:\lucee\tomcat\logs - tomcat logs, no orm.log
C:\lucee\tomcat\webapps\ROOT\WEB-INF\lucee\logs - orm.log empty
C:\git\thesiteinquestion.com\trunk\WEB-INF\lucee\logs - orm.log empty

But the orm.log seems to be empty no matter what I do. Where SHOULD it be-
in the WEB-INF for the specific site?

I have checked the Application.cfc for the app in question and set

this.ormsettings.logsql=“true”;

Anyone ever find an answer to this question?On Wednesday, July 6, 2016 at 6:27:56 AM UTC-5, Ivan McAvinchey wrote:

Many thanks for that Julian, that’s exactly where it is!

Any idea how to get it to log the actual parameters it is using? I can
find instructions for ColdFusion (
http://www.rupeshk.org/blog/index.php/2009/07/coldfusion-orm-how-to-log-sql/)
which involves configuring log4j, but not sure how to go about this with
Lucee.

Currently just have

    name=?,
    address1=?,
    address2=?,
    city=?,

etc. which is less than ideally useful.

Four years later but as I found this again in a Google search looking into Lucee logging, what I ended up doing for logging was simply to log the queries on the database side. This captures the actual queries with the parameter values. With MySQL I do this:

SET GLOBAL log_output = 'table'; # set log destination
TRUNCATE mysql.general_log; # clear out existing log
SET GLOBAL general_log = 'ON'; # turn it on
# do Lucee stuff you want to log
SET GLOBAL general_log = 'OFF'; # turn it off

And then query it using something like this:

SELECT event_time, CONVERT(argument USING utf8) AS query
FROM mysql.general_log l
WHERE command_type = 'Query'
	AND CONVERT(argument USING utf8) LIKE 'insert%'
	AND user_host = 'lucee[lucee] @ localhost [127.0.0.1]';

As it’s all in a table, it’s also easy to run statistics on it, like count queries matching a certain string etc.

SQL Server you can use Extended Events, a trace, or look in sys.dm_exec_sql_text.

1 Like