Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Sometimes the only way to really know what's going on with your application is to look at log files. Whether you're looking at the server logs or you own custom logs, this usually involves getting into the ColdFusion Administrator, browsing to a log file and then refreshing as you work to see what's going on. CF Builder includes the ability to watch a log file directly in IDE via the TailView. The TailView by default is in this bottom section along with your Servers and Console. If you don't see the TailView, just choose Window > Show View and locate the TailView.
To start using the view, click on Add log and a browse dialog will open up and I'm going to go into my ColdFusion9 installation directory, which is under Applications, ColdFusion9. On Windows, this'll most likely be under your C-drive in ColdFusion9 and the logs directory. I can see my application log, my server log, exceptions, etcetera. I'm going to click the application.log file and click Open. And now I can now see everything in the application.log file. I can see all of my Division by zero errors from my ColdFusion debugging video.
So, let's go ahead and open up this index.cfm file from Chapter 6. I'm going to add that 0 back into the file and let's cause an error. I'll save my file and then switch over to the Safari view and if you noticed, I now have a new entry down here that shows me my Division by zero error. So, as items get added to this log file they show up in TailView. Now I can add more than one log file. I'll click Add and let's add the exception log. Click Open and now I have the exception log sitting right next to my application log.
Now I can also watch logs that aren't necessarily part of the ColdFusion server. The TailView will look at any .log file. So, if you need to keep an eye on a job application or some other item on your system that's writing out log files, such as IIS logs, you can also have the TailView watch those logs as well. When you're done looking at a particular log, you can either stop it so that CF Builder no longer watches that log file and then you can start it back up again when you need it. You can also forcibly reload the log file, clear the log file in the display, so if I don't want to see that content any more, I can click that button.
It clears the entry in the TailView but leaves that data in the log file or I can actually remove the log file from my disk entirely. So, avoid hitting that one if you can and then I can remove that log tab. It's the same as clicking the little x here next to the name or I can remove all logs at once. So, let's do a little bit of custom logging. Let's go back over to our file here. I'm going to remove the 0 so that this will actually process all the way through and as we add items to my array, I'm going to log the fact that we did it.
So, I'll choose cflog and we're going to log it to a file called MathLog. We're going to add some text, Dividing the number 1 by, and then we'll put our divisor in there and then we'll make this strictly informational and close my tag. So, I'll save my file and take look at it in the browser preview and then click Add log and in my logs directory, I can now see my MathLog.
So, I'll click Open and now I can see each of those entries as it went through the loop. If I run this page again, you'll see I have another eight entries added to the log file. So, the TailView is an awesome way to get some visibility into your applications. Use the TailView along with the cflog tag, especially if you're using cfthread or some other asynchronous processing to see exactly what's going on in your application as it's happening.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97270 Viewers
61 Video lessons · 84542 Viewers
71 Video lessons · 68741 Viewers
56 Video lessons · 101233 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.