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

Ortus Black Friday Deals are here!

Ortus Black Friday Deals are here!

Make 2023, the year you finally start modernizing your CFML projects with our Black Friday deals!

Don't waste any more time trying to find solutions, we got everything you need to rock your projects and learn new skills that will save you time and money while delivering a quality service. 

From Nov 25th to Dec 1st

Maria Jose Herrera
Maria Jose Herrera
November 25, 2022
Call For Speakers Open for Into The Box 2023

Call For Speakers Open for Into The Box 2023

We are very excited that the Into The Box conference is coming back to the Houston area and FINALLY on our normal schedule of May of 2023. Registration is now officially open and call for papers is now open as well. We are also extremely excited that this will be our 10 year anniversary for the Into The Box Conference. So we will defintely go all out!

  • Full 2-day conference with over 30 different technology topics
  • An additional full day of hands-on training available for a veritable 3 days of awesomeness
  • A warm and sunny city of The Woodlands, Texas
  • When: May 17-19 of 2023
  • Modernize Your Skillz
  • Party with our live Mariachi Band!

Luis Majano
Luis Majano
November 11, 2022
New Patreon Perk: Ortus Software Craftsmanship Book Club

New Patreon Perk: Ortus Software Craftsmanship Book Club

What is the Software Craftsmanship Book Club?

Its a place for CFML Community members can get together, discuss and debate the thoughts, ideas, best practices outlined by a series of books focusing on increasing Software Developers efficiency, productivity and pride. It will be relaxed but educational environment, where we can learn from each other, and grow as a community.

 

Ortus Software Craftsmanship Book Club

Maria Jose Herrera
Maria Jose Herrera
November 09, 2022