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

 

 

Recent Entries

Hackers demand a ransom to restore data from my ColdFusion web applications!

Hackers demand a ransom to restore data from my ColdFusion web applications!

Hackers demand a ransom to restore data from my ColdFusion web applications!

Unfortunately, we often hear this message from clients who thought it would never happen to them... until it did. Some believed they could delay the expense of Implementing ColdFusion security best practices for one year, while others were tempted to put it off for just a few months. However, in today's rapidly evolving digital landscape, the security of web applications, including ColdFusio...

Cristobal Escobar
Cristobal Escobar
April 16, 2024
Ortus March Newsletter

Ortus March Newsletter

Welcome to Ortus Solutions’ monthly roundup, where we're thrilled to showcase cutting-edge advancements, product updates, and exciting events! Join us as we delve into the latest innovations shaping the future of technology.

Maria Jose Herrera
Maria Jose Herrera
April 01, 2024
Into the Box 2024 Last Early Bird Days!

Into the Box 2024 Last Early Bird Days!

Time is ticking, with less than 60 days remaining until the excitement of Into the Box 2024 unfolds! Don't let this golden opportunity slip away; our exclusive Early Bird Pricing is here for a limited time only, available until March 31st. Why wait? Secure your seat now and take advantage of this steal!

Maria Jose Herrera
Maria Jose Herrera
March 20, 2024