Blog

Brad Wood

December 21, 2016

Spread the word


Share your thoughts

Christmas is almost here and if you listen carefully you can probably hear the jingling bells on Santa's sleigh.  If you listen even harder, you can hear the cries of anguish from CF developers around the world who's server won't boot and they need to track down the console log!  In this next installment of the 12 Tips of (CommandBox) Christmas, we've got some help.

Server Logs

Whenever a CF server starts, there's a log file that captures the output that would have been sent to the console.  This can differ based on your servlet container, whether you're using Lucee or Adobe CF.  In CommandBox, we put the server's "out" log in the same place and give you an easy command to spill the contents of the log file:

CommandBox> server log

If you've been starting more than one server by name in the same folder, you can request each log file via the name of the server just like the rest of the server commands.

CommandBox> server log server1
CommandBox> server log server2

Too much text?  No worries, just pipe that unruly output through the more command for pagination or the tail command to view the last X number of lines.  Note: even if you're on Windows you can still use features like tail in the interactive CommandBox shell since we emulate the most common and useful bash operations for you.

CommandBox> server log | more
CommandBox> server log | tail lines=100

But wait, there's more

We've also got some cool new features cooking up on the bleeding edge of CommandBox which we'll be releasing soon.  You can grab this pre-release version here.

The first new feature is the ability to live-stream the console output (as well as other useful debugging information) to the console as the server starts. Once the server comes up and we open the browser window, we'll stop streaming and return you to the command prompt.  To get this behavior, just use the --debug flag when starting your server.

CommandBox> server start --debug

Oops, you just started your server and forgot the flag, but now you want to watch it come up?  No problem, the server log command we covered earlier has a new trick up its sleeve.  Add the --follow flag to server log and you'll immediately begin tailing the server's console output until you press Ctrl-C to quit.  This feature defers a the new --follow flag on CommandBox's tail command which allows you to live-tail ANY file you wish including application logs.

CommandBox> server log --follow

And finally, if you want to simulate the old behavior of starting your CF server from the command line, where the process runs in the foreground until you stop it, you can do this as well with the new --console flag on the server start command.  This will start the CF server in the foreground and live-stream the output to the console for as long as the server is up.  To stop, press Ctrl-C and CommandBox will stop the server and return you to the command line.

CommandBox> server log --console

 

 

Add Your Comment

(3)

Sep 13, 2017 05:28:38 UTC

by Mark Drew

Would you be able to also define which log you are following? for example application or mail?

Sep 13, 2017 08:18:00 UTC

by Brad Wood

Hi Mark, right now the "server log" command will just look at the servlet's "out" log. I like the idea of specifying another log, but I'm not sure how to combine servers since Adobe and Lucee have slightly different log files. Plus Lucee has two sets, one server context log dir and one web context log dir which can be confusing. Another idea we had was to make "server log --follow" somehow combine all log files at the same time for that engine into one stream. https://ortussolutions.atlassian.net/browse/COMMANDBOX-604

Sep 13, 2017 08:23:58 UTC

by Mark Drew

Using --follow would make sense and in essence for Lucee it would be an aggregation of the server and context logs. The server logs would be fairly quiet to be honest. It's confusing but the server logs would tell you about extensions. So basically --follow might be an answer and then you can grep it if you add something like "server/application.log" or (in ACF case) "application.log" (as per the ticket) Having the name highlighted before each entry how docker-compose does it would do the trick nicely!

Recent Entries

BoxLang 1.0.0 Beta 23 Launched

BoxLang 1.0.0 Beta 23 Launched

The latest release of BoxLang, Beta 23, marks a significant step forward in our journey to create the ultimate dynamic language for the JVM. Packed with powerful new features, important bug fixes, and thoughtful optimizations, this update is designed to make your development experience smoother, faster, and more reliable, especially after now starting to take 100s of comments and bug reports from our community.

Luis Majano
Luis Majano
November 23, 2024
TestBox Latest Updates and News!

TestBox Latest Updates and News!

We’re thrilled to have launched the new TestBox website and TestBox 6.0! If you haven’t had a chance to explore yet, visit TestBox to discover updated documentation, powerful resources, and features that make testing more efficient than ever.

Maria Jose Herrera
Maria Jose Herrera
November 21, 2024
Is Your ColdFusion Application Ready for the Future?

Is Your ColdFusion Application Ready for the Future?

In a rapidly evolving digital world, maintaining performance, security, and scalability for ColdFusion applications is more challenging than ever. Whether you're using Lucee or Adobe ColdFusion, legacy systems can become a bottleneck for growth, innovation, and user satisfaction. The need to future-proof your ColdFusion applications has never been more critical.

But where do you start?


The Hidden Costs of an Outdated ColdFusion Application

As you...

Cristobal Escobar
Cristobal Escobar
November 21, 2024