Programmatically create log file

I am using the ‘org.lucee.cfml.Administrator’ component to create a log file using the method:

updateLogSettings();

Sample code:

admin.updateLogSettings(name = “File1”,
level = “INFO”,
appenderClass = “lucee.commons.io.log.log4j2.appender.ResourceAppender”,
appenderArguments = {
charset = “UTF-8”,
path = “{lucee-config}/logs/File1.log”,
maxfiles = “10”,
maxfilesize = “25000000”,
timeout = “1”
},
layoutClass = “org.apache.logging.log4j.core.layout.PatternLayout”,
layoutArguments = {
pattern = “%d{yyyy.MM.dd HH:mm:ss} %m%n”
});

The code above successfully creates the file.
However, when a line is written to the log file, the formatting does not use the specified layout pattern.

Example:

WriteLog(text=“Hello World”, log=“File1”);

Expected output:

2025.11.18 11:07:09 Hello World

Actual output:

18.11.2025 11:07:09,884 INFO [server.cb0cda94-72f5-49d4-8df6-eccf00cbbb19] Hello World

How can I make it use the specified layout pattern?

thank you.

Lucee Version : 6.2.3.35

Please try this with <cfadmin> — it works as expected.

admin
		action="updateLogSettings"
		type="server"
		password="password"
		name="File3"
		level="INFO"
		appenderClass="lucee.commons.io.log.log4j2.appender.ResourceAppender"
		appenderArgs={charset : "UTF-8",
            path : "{lucee-config}/logs/File3.log",
            maxfiles : "10",
            maxfilesize :"25000000",
            timeout :"1"
        }
		layoutClass="org.apache.logging.log4j.core.layout.PatternLayout"
		layoutArgs={pattern: "%d{dd.MM.yyyy HH:mm:ss,SSS} %m%n"};
      `writeLog(type="information", file="File3", text=" Hello World");`
1 Like

Your response identified my problem.

The problem was with

layoutArguments

I changed it to:

layoutArgs

and now it writes to the log file using the specified pattern.

Thank you very much for your help.

1 Like