> I am wondering if anyone can give me some advice on what is > the best route to take. I am trying to design an method that > would allow all messages that are created by CF (errors and > so on) to captured and saved in a database for future use and > debugging purposes. The reason I am trying to do is that I > do not access to the production CF admin console so I cannot > access the logs files and I have to open a work request with > our web services team to have them download a copy of the log > so that I can read it and this takes days for them to > complete and by that time it is usually too late.
The problem with this approach is that, if you have database problems, you may well also have logging problems for obvious reasons! Instead, I'd recommend that you directly access the log files (or build code that will allow you direct access) rather than viewing them from the CF Administrator. > My problem is that I am confused as to what the differences > are between TRY/Catch blocks and CFLOG and or a generic error > page (CFERROR). Has anyone done this in their applications > before and if you could you explain to me what is the best > route to take. Well, error handling is a bit complicated actually. First, let's distinguish between exception handling using CFTRY and CFCATCH, and generic error handling using CFERROR or the site-wide error handler. When you use an exception handler, you can deal with specific problems within your code and provide very specific solutions, and your code can continue to run in many cases. That's really the big advantage of exception handling in my opinion. When you successfully handle an exception, you don't really generate an error at all in many cases, although you may want to log some information about the exception for debugging purposes. By default, when you catch an exception, nothing is logged. Exception handlers are also very useful in component-oriented systems, in which a component may throw an exception to its caller rather than generating a generic error. The caller can then dispose of the error if it can, or escalate the exception to a generic error handler if it can't. The important thing in this case is that the component isn't making the decision about how to handle the problem, but rather defers to the caller for that. If you don't have both a specific problem that you expect, and a specific solution for that problem, exception handling is less useful and you might then use a generic error handler like CFERROR. When you use a generic error handler, the flow of your program is broken and the user will be redirected to the error handler. In any case, you may want to log information yourself to a location of your choosing, and that's where the CFLOG tag comes in. CFLOG may handily solve your problems by letting you log errors to a file that you can get to, rather than to the standard CF log files. > I like the log viewer that comes with MX as I can use the admin > console on my Dev box but on my production server I cannot get > to the log files. I have tried to write code to read them but > it look like they are not in the same place as they are in > development. I would be very surprised if your server is configured in a way that you can't get access to the files. You may have to go looking for them, though. Presumably, you can find their location by looking within the CF configuration files, although I'm not sure offhand which one you'd look in. Alternatively, you could log errors to a file of your choosing using CFLOG as described above. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191851 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

