Release: ProcessLogs
Started by Nico, Nov 24 2011 11:59 AM
7 replies to this topic
#1
Posted 24 November 2011 - 11:59 AM
Hi,
today I'm proud to release my first Module: the "ProcessErrorLog"-Reader.
It gives you the ability to read the error log in the backend. You can sort it and clear it.
Maybe you just want to try it out. You can download it here:
[UPDATE]
I renamed this project to ProcessLogs. Now you can download it here:
https://github.com/N...oll/ProcessLogs
today I'm proud to release my first Module: the "ProcessErrorLog"-Reader.
It gives you the ability to read the error log in the backend. You can sort it and clear it.
Maybe you just want to try it out. You can download it here:
[UPDATE]
I renamed this project to ProcessLogs. Now you can download it here:
https://github.com/N...oll/ProcessLogs
#2
Posted 24 November 2011 - 12:17 PM
Nico congratulations! This sounds great and very useful. Will try this soon!
Follow me at Twitter - Mostly about ProcessWire AdminBar - Simple front end editing for PW ProcessRedirects - Manage redirects in PW-admin
#3
Posted 24 November 2011 - 12:54 PM
Installed it in my test environment and it looks very nice and usefull. Good job!
#4
Posted 24 November 2011 - 02:51 PM
Tested here too. Seems to work great – nice work Nico!
I have a couple of suggestions. For loading/writing to the log file, I recommend replacing this:
With this:
I was also wondering about this:
Couldn't you just do this instead?
In your getInstalledPage() function, I recommend adding this before the $page->save():
That will ensure it gets placed as the last item on the Setup page, rather than potentially in between Template and Fields.
Lastly, take a look at PW's FileLog class: /wire/core/FileLog.php. This is what PW uses to create the log files. It includes two functions that may be handy in a future version of your module – particularly if you ever have to deal with really large log files (which may not be very likely with PW's error log). It includes a get($bytes) function that returns lines from the end of the file, without having to load the whole file. It also includes a prune($bytes) function that prunes a log file down to a specific size, leaving all lines in tact from the end of the file. This is preferable to clearing sometimes as it still leaves the most recent entries in tact. PW doesn't currently utilize either of these functions anywhere but just wanted to let you know they were there in case you ever find them useful. I originally coded them thinking of a log viewing/management utility module.
I have a couple of suggestions. For loading/writing to the log file, I recommend replacing this:
'../assets/logs/errors.txt'
With this:
$config->paths->logs . 'errors.txt';
I was also wondering about this:
$url = explode('/', substr($_SERVER["REQUEST_URI"],0,-1));
unset($url[count($url)-1]);
$url = implode($url, '/').'/';
header('Location: '.$url);Couldn't you just do this instead?
$session->redirect("../"); In your getInstalledPage() function, I recommend adding this before the $page->save():
$page->sort = $parent->numChildren;
That will ensure it gets placed as the last item on the Setup page, rather than potentially in between Template and Fields.
Lastly, take a look at PW's FileLog class: /wire/core/FileLog.php. This is what PW uses to create the log files. It includes two functions that may be handy in a future version of your module – particularly if you ever have to deal with really large log files (which may not be very likely with PW's error log). It includes a get($bytes) function that returns lines from the end of the file, without having to load the whole file. It also includes a prune($bytes) function that prunes a log file down to a specific size, leaving all lines in tact from the end of the file. This is preferable to clearing sometimes as it still leaves the most recent entries in tact. PW doesn't currently utilize either of these functions anywhere but just wanted to let you know they were there in case you ever find them useful. I originally coded them thinking of a log viewing/management utility module.
#5
Posted 24 November 2011 - 04:13 PM
Version 1.08 is out (you can download it on Github - link is in the first post). I changed the functions like Ryan recommended. But I still want it to read all of the errors and so I left this part of the code untouched.
#6
Posted 25 November 2011 - 12:05 PM
Version 1.09 is alive.
It now supports all of the logs (not only the error log).
Before you install this version please uninstall the old one!
And it has a new GitHub URL: https://github.com/N...ll/ProcessLogs (also updated it in the first post)
It now supports all of the logs (not only the error log).
Before you install this version please uninstall the old one!
And it has a new GitHub URL: https://github.com/N...ll/ProcessLogs (also updated it in the first post)
#7
Posted 25 November 2011 - 02:28 PM
Ther error log works.
THe error messages overlap the table, they're too long to fit in the cells. I suggest to trim them to 50chars and when on hover show the message in a layer? Or use collapsible InputfieldWrapper fieltype to make each error an element, with the date time and cut message as label, and if open show the whole message. Just ideas.
Also when I clear the log... I get this notice:
If I select the LoginNotifier Log it shows me these:
and it doesn't show the log messages, just a table with 20 times the same date time...
Do you know the login notifier is configurable and its possible to define own fields that get logged? How are you handling this?
THe error messages overlap the table, they're too long to fit in the cells. I suggest to trim them to 50chars and when on hover show the message in a layer? Or use collapsible InputfieldWrapper fieltype to make each error an element, with the date time and cut message as label, and if open show the whole message. Just ideas.
Also when I clear the log... I get this notice:
Notice Undefined index: file in /site/modules/ProcessLogs/ProcessLogs.module on line 52 Notice Undefined variable: errors in <b>/Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 76
If I select the LoginNotifier Log it shows me these:
Warning: array_combine() [function.array-combine]: Both parameters should have an equal number of elements in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 69 Warning: array_combine() [function.array-combine]: Both parameters should have an equal number of elements in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 69 Warning: array_combine() [function.array-combine]: Both parameters should have an equal number of elements in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 69 Warning: array_combine() [function.array-combine]: Both parameters should have an equal number of elements in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 69 Warning: array_combine() [function.array-combine]: Both parameters should have an equal number of elements in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 69 Notice: Undefined index: page in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 82 Notice: Undefined index: type in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 83 Notice: Undefined index: description in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 84 Notice: Undefined index: user in /Applications/XAMPP/xamppfiles/htdocs/pw2.ch/site/modules/ProcessLogs/ProcessLogs.module on line 81
and it doesn't show the log messages, just a table with 20 times the same date time...
Do you know the login notifier is configurable and its possible to define own fields that get logged? How are you handling this?
@somartist - wire("soma")->is("creative|coder")->say("hello");
#8
Posted 25 November 2011 - 07:52 PM
Well I thought every log is the same. But it isn't. So I will have a look at the login module and figure out a solution.
And which kind of error reporting you have activated?
And which kind of error reporting you have activated?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












