No application.log written, but others are

OS: Ubuntu 20.04
Lucee Version: Docker image lucee/lucee:5.3-nginx

Is there some reason why I’d not get anything (even an empty file) for application.log, but do get ones for things like exception.log ?
I’ve added a writeLog() to a basic index.cfm but do not seem to get anything output.

catalina.out in the image shows nothing unusual.

root@270a9c6fb41d:/opt/lucee# ls -laht  WEB-INF/lucee/logs/
total 28K
-rw-r-----  1 root root 2.8K Jun  8 09:25 exception.log
drwxr-x--- 19 root root 6.0K Jun  8 08:59 ..
drwxr-x---  2 root root 6.0K Jun  5 16:59 .
-rw-r-----  1 root root    0 Jun  4 18:25 scope.log
-rw-r-----  1 root root    0 Jun  4 18:25 gateway.log
-rw-r-----  1 root root    0 Jun  4 18:25 remoteclient.log

This creates a foo.log OK :slight_smile:

<cfset writelog(text='hello #now()#',file='foo')/>

log='Application' does not, but file='application' works as expected.

So somehow I’ve changed the default log location ?1?

I’m getting output from Lucee itself to application.log e.g. from recently when I restarted the container :

"INFO","Thread-11","06/08/2020","14:12:33","lucee.runtime.engine.Controler","check size of directory [/opt/lucee/web/temp]; current size   [0];max size    [1073741824]"
"INFO","Thread-11","06/08/2020","14:12:33","lucee.runtime.engine.Controler","check size of directory [/opt/lucee/web/cache]; current size  [0];max size    [104857600]"

just not anything from my own writelog() !

@thefalken, Yeah, it’ll happen in every restart. See this link for FYI:
So, if you didn’t like means, change the log level info to error.
And it’ll not happen to any other log files.

Cheers @cfmitrah - nice to know where it comes from.

Any ideas where my writelog() are going ?
My …/WEB-INF/lucee/lucee-web.xml.cfm does not have any ‘logger’ entries, but it should just use the ones from lucee-server.xml right ?

@thefalken, You can see the log files from /WEB-INF/lucee/logs/

@cfmitrah I think you might have not understood the whole issue ?
There wasn’t an applicaiton.log file at all.

As soon as I go to the web admin, and add a new application log there manually, writelog() works.
Nothing was coming out from writelog() till I did that. This isn’t expected, surely ?

I.e in …/server.cfm?action=server.logging there is an application.log but …/web.cfm?action=server.logging did not list an inherited one (it lists others)

What could cause it not to pick up application log settings from the main server ? I can see an application log defined there fine.

The created WEB-INF/lucee/lucee-web.xml.cfm has no logger tags at all.

Is this file generated from some template somewhere I need to update ?

@justincarter is there something funny about what the Docker image does for logging ?
In our deployments, the files for web root’s are mounted via NFS (well, Amazon EFS really) onto the Docker host then mapped into the Lucee container.

The Lucee Docker images don’t do anything special in regards to logging. Permissions can be problematic when you use volumes/attached storage and run things as users/uid/gids that don’t exist on the host but I don’t think that’s your issue here.

The default location for web context logs is;

If you have WEB-INF in the path then I guess you might have customised the web context location, but that also shouldn’t cause problems.

The default lucee-web.xml.cfm usually has a <logging> element with a number of items configured;

This copy of the file might be due some updates for Lucee 5.3 but the loggers have always been there as far as I know. If yours are missing you can try adding them to see if that resolves the issue.

1 Like

Sorry, I’m unclear - the default lucee-web.xml.cfm is kept where ?

The default web context directory is /opt/lucee/web;

So the web context XML would usually be in /opt/lucee/web/lucee-web.xml.cfm

If you’ve customised the Tomcat XML files then the location could depend on your configuration.

I’ve only got minimal changes so far to our images lucee-server.xml and it definitely still contains a logger for application logs (hence, I can see it in server admin).

The only other change we have is to set up mod_cfml and name based virtual hosts in Nginx - nothing that should effect Lucee’s logging…

I’ve written the following to /opt/lucee/web/lucee-web.xml.cfm (in the Docker image) and redeployed.
The created …/mysite/dev/WEB-INF/lucee/lucee-web.xml.cfm lacks any logger tags.

		<logger appender="resource" appender-arguments="path:{lucee-config}/logs/remoteclient.log" layout="classic" level="info" name="remoteclient"/>
		<logger appender="resource" appender-arguments="path:{lucee-config}/logs/requesttimeout.log" layout="classic" name="requesttimeout"/>
		<logger appender="resource" appender-arguments="path:{lucee-config}/logs/mail.log" layout="classic" name="mail"/>
		<logger appender="resource" appender-arguments="path:{lucee-config}/logs/scheduler.log" layout="classic" name="scheduler"/>
		<logger appender="resource" appender-arguments="path:{lucee-config}/logs/trace.log" layout="classic" name="trace"/>
		<logger appender="resource" appender-arguments="path:{lucee-config}/logs/application.log" layout="classic" level="info" name="application"/>
		<logger appender="resource" appender-arguments="path:{lucee-config}/logs/exception.log" layout="classic" level="info" name="exception"/>

What we ended up doing was just having our deployment scripts check for and create if missing the lucee-web.xml.cfm file in each web root.

Ran into this problem on a brand new Ubuntu 20.04 and Lucee 5.3.6 installer. Application log is listed in Server Admin but not Web Admin. Application.log in /opt/lucee is being written to but no application.log in WEB-INF.

Did you try dumping out the directory placeholders ?

Directory placeholders are fine. The logs use {lucee-config} and it is correct.

System Admin shows {lucee-config}/logs/application.log. I manually added the same to Web Admin a while back and finally got something written to it from my site code. I do not see the exceptions except in the system application.log anymore. Of course web exception.log shows those.

I also notice that a manually created application.log (see work arounds above) does not include anything in the “application” section

writelog(text='Application starting name #getapplicationmetadata().name#',file="application")
"INFO","http-nio-8888-exec-10","08/06/2020","11:59:49","","Application starting name foo.localdomain"

FYI, I created a bug about this problem last week

I put a full test case for missing application names in but the last RC was 2 months ago and nothing appears to be happening.