Where Are the Logs for a Thread

Trying to use threads for the first time.
I think I can solve all my issues if I can find the log files for the thread.
Anybody?
Thanks in Advance.

km

Lucee 5.3.8.206
Tomcat 9.0.35
Java 11.0.7
Windows 2019 (on AWS)

Update.
I found thread.log in WEB-INF/lucee/logs.
This will be a great help.

Update 2:
Thread.log helped me get my code inside the thread working, so I was able to then determine that I can write my own logs from inside the thread and they show in the same WEB-INF/lucee/logs folder.
That will take care of it for me.
But I would welcome any further discussion from anyone trying to debug threads.

tx,
km

Lucee 6.0 has optional debugging for threads, but it’s not quite available in beta just yet

https://luceeserver.atlassian.net/browse/LDEV-3380

in 5.3 what you can do is the following

var debugData = getPageContext().getDebugger().getDebuggingData(getPageContext());
FileWrite('c:\temp\log-#gettickCount()#.json',serializeJson(debugData));

I have a bad habit if making unintentional tyops in my code so I feel your pain. Threads can hide this, as you discovered.

This is the pattern I like to use (logging is good too if you go look there).

<cfscript>
thread name="threadTest1"{
	thread.error = {}
	try {
		thread.data = 1 + 2
	} catch(e) {
		thread.error = e
	}
}
thread name="threadTest2"{
	thread.error = {}
	try {
		thread.data = 1 + 2
		thread.foo = bar // force an error
	} catch(e) {
		thread.error = e
	}
}
thread action="join";
dump(cfthread.threadtest1)
dump(cfthread.threadtest2)
</cfscript>

As you dive further into threads, be aware of race conditions. They can hide even simple errors that wouldn’t be an error without the concurrent processing.

https://www.rasia.io/blog/safe-concurrency-with-lucee.html

Enjoy

1 Like

Joke is on me: “tyops” was the only intended error here.

1 Like