Log file location?

Windows Server 2022/IIS10
Java 11.0.21
Tomcat Version 9.0
Lucee 6.0.0.585
MS SQL 2022

Being new to Lucee, please excuse the amount of posts I might make while I get up to speed, and thanks in advance to those that post in with some support

I’ve got my first 500 error for some CFM that works on ACF2016. I actually need help with that one so will post a separate ticket.

First question, where can I find the exception logs in Lucee? I see a log directory at C:\lucee\tomcat\logs with some TXT files in there, but no exception file

Thanks
Mark.

Hi,

There are a lot of log files, you can find logs for your exceptions in your application in the exception.log.
file located at
Your-web-Root\WEB-INF\lucee\logs and tomcat\lucee-server\context\logs.
A better idea is to use onerror in the ‘application.cfc’ file to specify the location where you want your logs.

component {

    // Define your application settings here
    
    this.name = "MyApplication";
    this.sessionManagement = true;
    // Other settings...
    
    // Define the onError function to handle exceptions
    function onError(exception, eventname) {
        // Log the exception details to a file or database
        // For example, you can use cflog to log to a file
        cflog(file="error", text="An error occurred: #exception.message#");
        
        // Optionally, you can also display a user-friendly error message
        // to the end user
        writeOutput("An unexpected error occurred. Please try again later.");
        
        // Return true to prevent the default error handler from executing
        return true;
    }

}

The number of logs is an issue. For getting started, consider the log viewer extension in the lucee admin that Zach wrote; it aggregates the logs as you choose using filters. Its pretty good.
For me, I have agents that send the all logs to the cloud and aggregate them there for further analysis… but there are obviously a ton of option for log aggregation that don’t involve using a cloud service too.
Long term though, putting effort into log aggregation is a huge win, especially for devs new to Lucee. For example - if you make a prod fix and there are issues, you can keep a close eye on your master log feed after deployment and not have to worry about the fact that Lucee/tomcat bury logs in 27 different files :wink:

Thanks @cfmitrah I found the logs as you suggested in tomcat\lucee-server\context\logs

@anderslars27 I shall add that task to my to-do list, albeit a rather lengthy one :slight_smile: Thanks.