How to configure Railo so that cflog logs its data to console

276 views Asked by At

I want to configure Railo in such a way that cflog will log its data to console, not to file. I have Railo (4.1.2.005) with Tomcat 8.

<cflog type="Information" text="Test data" log="application">  

Normally when we write code like above, it logs the information in application.log file in WEB-INF\railo\logs folder. I want this information to be logged in stdout or stderr.

The cloud where I am running the Railo application has been configured for reading data from console. It is not able to read data from file and that is why I am not able to read the standard Railo logs, which include application.log, requesttimeout.log, scheduler.log etc.

It would be great if someone could let me know how to configure Railo so that it uses the console for logging.

1

There are 1 answers

0
isapir On

You can write output to the out or err stream by using the built-in function SystemOutput:

SystemOutput(message, addNewLine, errStream)

e.g.

SystemOutput("test stdout", true);
SystemOutput("test stderr", true, true);

See http://docs.lucee.org/reference/functions/systemoutput.html

That function has been in the code base for many years and I'm pretty sure that your Railo version has it.

In Lucee, logging was refactored to use the Log4J framework, which gives you much more control about where to log the messages to and the log format. So you can log for example to system out, a database, a web service, etc.

So you should consider to upgrade your Railo setup to Lucee.