How do I view error logs? |
[eluser]snifty[/eluser]
I have a logs directory under application in my app, and it contains a couple files, which look like this: Code: $ cat log-2011-06-14.php My question is, what is the "right" way to view these files? they're clearly not PHP files, so I don't understand why they're assigned a .php filetype and that "No direct script" restriction. Is the idea that error logs should only be viewed through a terminal? I will read Logging.php and try to figure out the reasoning here, but I thought I'd ask the question as well. Thanks folks...
[eluser]InsiteFX[/eluser]
Just click on the filenames, they are saved as normal text files so your default text editor should just load them up! InsiteFX
[eluser]TWP Marketing[/eluser]
I think (opinion), that the script access restriction is a simplistic way to prevent anyone but the programmer/administrator from viewing the log files. The logs might give insight into how a program is designed and/or contain information which might be used to hack a database. If you WANT the admins to see the logs, just build a view and hide it behind the admin login.
[eluser]John_Betong_002[/eluser]
The post prompted me to stop procrastinating and to add the facility of log file viewing and deletion if and only if on your http://localhost/ Five steps to view your log file in a popup window: step 1. include this line in your views: ./application/view/view_main_or_whatever_it_is_called.php Code: <body> step 2. add these lines to: ./application/config/routes.php Code: $route["popup_view_errors"] = "c_view_errors"; step 3. NEW Controller file: ./application/controllers/c_view_errors.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); step 4. NEW file: ./application/views/_box_view_errors.php Code: <?php step 5. NEW Popup View file: ./application/views/_box_view_errors.php Code: <?php /* file: ./application/views/_box_view_errors.php */ ?> edit Replaced correct controller file. Renamed popup view file. Added button link script
[eluser]snifty[/eluser]
Hi John, This looks like a useful way to view logs. What's _box_view_errors.php all about?
[eluser]John_Betong_002[/eluser]
[quote author="snifty" date="1308801498"]Hi John, This looks like a useful way to view logs. What's _box_view_errors.php all about?[/quote] Whoops, I renamed "_box_view_errors.php" and did not change the old file name. My post has just been edited and now shows the correct file name and the include file name. Here is a partial screen dump when the "View errors" link is called. http://johns-jokes.com/afiles/images/c-_...g-file.jpg |
Welcome Guest, Not a member yet? Register Sign In |