Lucee mixes up web contexts when writing log files

Hi, we run Lucee servers with 5 static web contexts on each one. The 5 sites share some cfc components and also have code that isn’t shared but is similar. For example in these sites there are lots of lines like:

<cflog file="mailrecord" application="true" text="Emailed his report"/>

The problem we are seeing is that Lucee is appending this data to the log file under the wrong web context. So for example in the file WEB-INF/site_one/logs/mailrecord.log we have lines like:

“INFO”,“Thread-250”,“03/21/2023”,“11:19:53”,“site_one”,“Emailed his report”
“INFO”,“Thread-250”,“03/21/2023”,“11:43:13”,“site_one”,“Emailed about new data”

Nothing wrong with those. But we also have lines like:

“INFO”,“Thread-250”,“03/21/2023”,“12:21:01”,“site_two”,“Emailed someone about something”

In my tests, requests on site_one were logged correctly until I visited site_two, then requests for both site_one and site_two went into the log file for site_two. I tried this test on, the version 6 beta, and a couple of older versions on the 5.3 release (the oldest I tried was They all exhibited this problem.

I know cflog file="filename" is deprecated, but we have a ton of legacy code that uses it. During this test I also tried using cflog log="logname_from_administrator", but I could never get any log lines to show up in the files. The “logname_from_administrator.log” file was created for each site, but they only contained the header, never any data. The log level in the administrator for logname_from_administrator was set to INFO.

This issue might be similar or the same to the one we reported a few months ago, which did get marked as fixed:

Thanks for any help.

OS : Windows 2019
Java Version : 11.0.18
Tomcat Version : 9.0.71
Lucee Version :

Hi @stillnet, I’ve checked this issue with above mention steps on Lucee version . But unfortunately the issue not replicated. Could you please verify the log “logname_from_administrator” created in administrator and make sure that the appender is set to “resource”?

It my real test the named log was called “whoseline2” (cflog log="whoseline2").

The file log was called whoseline (cflog file="whoseline").

As I said I could not get any output from lines like <cflog log="whoseline2" text="whatever"/>

Or even <cflog log="mail" text="whatever"/> (and we all know for sure that the mail log is defined).

But this does work, and it always logs to the correct context:
<cfset getPageContext().getLog("mail").info("mail", "blah blah")/>

Is the line above safe to use? This can be my workaround for now. I’ll just put my email debug lines into the main mail log.

@cfmitrah can you tell me what steps you took to reproduce, where you could not reproduce it? I was able to reproduce it on a fresh install of Lucee ( on Tomcat 9.0.62).

First I modified the server.xml file to contain these two lines inside the default <Host> tag:
<Context path="/site1" docBase="c:\site1" />
<Context path="/site2" docBase="c:\site2" />

This defines two websites/contexts, which is required to reproduce this bug. In our setup our websites exist on different domains, but for simplicity in reproducing this problem I am using the same domain.

Then I created two cfm files, one in each of the directories specified above.

c:\site1\index.cfm contains:

This is site 1
<cflog file="whoseline" text="This is from site1"/>

c:\site2\index.cfm contains:

This is site 2
<cflog file="whoseline" text="This is from site2"/>

The next steps are:

  1. start Lucee
  2. browse to http://localhost:8888/site1/index.cfm
    You’ll see an entry in the site1 whoseline.log file.
  3. browse to http://localhost:8888/site2/index.cfm
    You’ll see an entry in the site2 whoseline.log file
  4. browse back to http://localhost:8888/site1/index.cfm again
    You’ll see an incorrect entry in the site2 whoseline.log file

Please let me know if I can be of further help. I could zip up this whole directory for you if you want.


are you defining the logs under each web context? the screenshot above is from the server context

Seems like you’re not creating 2 different web contexts, as site1 & site2 is placed inside the default context… Can I have the full path of the WEB-INF directory ( means WEB-INF/site_one/logs/mailrecord.log ) ?

@cfmitrah They are indeed two different web contexts. Tomcat allows you to create web contexts in any folder. These screenshots from the web admin shows they are two separate contexts. You can see the hash, etc. is different.

I only did it this way so I could give you simple instructions to reproduce, without making you setup DNS entries, etc. In our production environment (which also encounters this bug) each web context has it’s own <Host> entry on a separate domain.

The full path to the log files are:

@Zackster No I am not defining the logs under each context. That is the point of using <cflog file=>, right? (As opposed to <cflog log=>, which requires the log to be defined.)

My screenshot showing the log being registered in the admin was related to my point about how <cflog file=> is deprecated, and I was pointing out that I cannot get <cflog log=> to work either. Even when registering that log in the admin.

But let’s ignore all that for now, for simplicity in our discussion let’s focus on the <cflog file=> functionality logging to the wrong context.

Is there anything I can do to help here? Would you like me to mock up another test and zip all up and provide it?

I’ve replicated this issue using the steps mentioned above with lucee version Lucee mixes web contexts when writing log files using the cflog file attribute with two different domains.

Seems file attribute is deprecated for cflog tag (<cflog> :: Lucee Documentation). So use log attribute instead of file

"INFO","http-nio-8888-exec-10","04/19/2023","11:01:31","","This is from site2"
"INFO","http-nio-8888-exec-5","04/19/2023","11:02:13","","This is from site1"

But it writes the log correctly using cflog log attribute (log=“whoseline2”)

"INFO","http-nio-8888-exec-10","04/19/2023","11:23:58","","This is from site1"
"INFO","http-nio-8888-exec-7","04/19/2023","11:24:13","","This is from site1"

@stillnet Can you please try this with log attribute in cflog tag and report here back?

We had this discussion about ‘log file’ vs ‘log log’ a while ago … related to LDEV-4263. That scenario was passing file=application (which was fixed) and this slid under the radar with custom one-off files.

Lucee should not have deprecated log file attribute also mentioned in Nov.
Why? Glad you asked:
This is an ACF compat issue AND plenty of 3rd parties use log file (FuseGuard being one common one) as also mentioned in the older thread.

Unless there’s a programmatic way to set these logs up, it’s tediously ridiculous to define these (even for a small shop like 5 servers hosting 10 sites/contexts). Just setup the log means 50 touch points per log file! which I previously named a file on the fly with a <cflog file="LDEV-4263" ...>

Can you please try this with log attribute in cflog tag and report here back?

Hi @cfmitrah, yes I have tried this, you can see in the previous messages in this thread. I just tried it again this morning, and I get the same results.

Simply switching file="whoseline" to log="whoseline3" results in this error: The attribute log [whoseline3] does not exist

If I go into the Lucee server admin and define the whoseline3 log file (and BTW I set it to loglevel=INFO), then the error goes away, but I never get a whoseline3.log file in my WEB-INF/logs directory.

Also, even if this did work, I feel this is an unreasonable workaround (having to define the log file in the administrator) because many applications (including ours and Pete Freitag’s FuseGuard for example) use cflog file= so that the setup is simple and painless, without having to touch the admin to register a log file.

This ticket [LDEV-4263] - Lucee was reopened.

1 Like