dereuromark / cakephp-databaselog Goto Github PK
View Code? Open in Web Editor NEWDatabaseLog CakePHP plugin to log into DB instead of files. Better to filter and search.
License: MIT License
DatabaseLog CakePHP plugin to log into DB instead of files. Better to filter and search.
License: MIT License
This should be fixed by changing config/routes.php
, and requiring cake 4.3
diff --git a/config/routes.php b/config/routes.php
index 6ed7cdd..0cd2bce 100644
--- a/config/routes.php
+++ b/config/routes.php
@@ -3,7 +3,8 @@
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
-Router::prefix('Admin', function (RouteBuilder $routes) {
+/** @var \Cake\Routing\RouteBuilder $routes */
+$routes->prefix('Admin', function (RouteBuilder $routes) {
I tried to make a PR but couldn't get test to run with new Test Migrator
Thank you for your work.
I downloaded your plugin via composer and installed it completely. I've loaded the plugin with routes => true and managed to load 'database-log/logs'. However when I try to access 'Details' or 'Delete' I get the following:
Error: A route matching "array ( 'controller' => 'Users', 'action' => 'login', 'plugin' => NULL, 'prefix' => 'admin', '_ext' => NULL, )" could not be found.
I get the above when I try to access: admin/database-log/logs/view/37
Seems to be an issue with Auth. I managed to solve it by adding the following in the LogsController of your plugin;
public function beforeFilter(Event $event) {
if ($this->Auth->User('role_id') == 1)
$this->Auth->allow(['logs', 'index', 'view', 'delete']);
}
However I'm not sure if this is the right way to handle it.
Running cakephp v 3.3.16
DatabaseLog controller
=> /admin/database-log
Containing count of all types and maybe important excerpts of the errors etc.
Hello there,
nice plugin. I am curious how can it be used with AuthComponent. In Plugin/DatabaseLog/Controllers I added a befreFilter function with $this->Auth->allow();
If I update the plugin through composer, won't these files be overwritten? Is there a way not to do so?
When displaying >> 10000 messages, the message mediumtext is slowing things down for pagination.
We must remove that field here for select() and instead use e.g. summary field as varchar 255 summary field here to display the essence of this log entry.
prio: high
Same as https://github.com/dereuromark/cakephp-queue/blob/master/docs/sections/configuration.md and other plugins
datasource
is an internal detail, we should use connection, this would also be in sync with documentation on how to run migrations:
'DatabaseLog' => [
'connection' => 'my_datasource',
],
and
bin/cake Migrations migrate -p DatabaseLog -c my_datasource
I have test connection configured only in my dev environment.
On production where there is no test
connection defined I get an error:
Error: The datasource configuration test was not found in config/app.php
which is caused by DatbaseLogsTable::ensureTables() method.
I think this (ensuring tables) should be at least optional.
Can you confirm? Any idea why?
Hi,
Is it possible to bring out a new release?
Thank you in advance.
Cheers,
Frank
Hi!
I use this plugin and a slightly altered version of the cakephp-app template and the testMissingTemplateInDebug()
https://github.com/cakephp/app/blob/master/tests/TestCase/Controller/PagesControllerTest.php#L75 test fails on me.
I think it might be because a missingTemplate Exception is thrown (deliberately), which starts this database log plugin, but it's looking for a test-log datasource configuration:
Cake\Datasource\Exception\MissingDatasourceConfigException: The datasource configuration "test_database_log" was not found.
That config doesn't seem to exist.
How can we fix that, how can we ensure the test_database_log config does indeed exist?
We could add the test_database_log connection in your bootstrap.php, just like we do with database_log, but I'm not sure that is the way to go. Do you have any insight on this? Except Disabling databaselog for testing https://github.com/dereuromark/CakePHP-DatabaseLog/tree/master/docs#disabling-for-tests. :)
Running version 3.0.0 of this plugin on CentOS 7 in CakePHP 4.1.3. Followed the installation/configuration instructions. Plugin is loaded with 'routes' => true option. The Friends of Cake "Search" plugin is also loaded. When I try to load localhost/admin/database-log/logs
, I get the following error:
DatabaseLog.LogsController could not be found
The LogsController is present, however.
When I just load localhost/admin/database-log
, I can see the error log entries. I cannot , however, use any of the filters or any of the actions (Remove Duplicates, Reset Logs) without getting the following error:
Search.PrgComponent could not be found.
I'm guessing that's because I should be loading admin/database-log/logs
instead of admin/database-log
. Can you suggest what I should look for to fix this?
Running CakePHP v3.3.16 I've noticed a very strange issue with logging manually (i.e. using Log::write() from a controller or a view)
It seems that logs are being written to the database twice. After several testing I've noticed that the issue is due to the config in the app.php file;
'Log' => [
'debug' => [
'className' => 'DatabaseLog.Database'
],
'error' => [
'className' => 'DatabaseLog.Database'
],
],
With the above config, the logged will save two records in the table. But the following config will save only one record:
'Log' => [
'debug' => [
'className' => 'DatabaseLog.Database'
]
],
I think I may go crazy - but just slightly.
So, I've loaded the plugin, setup the CakeLog config and I'm trying rather desperately to get this to work.
CakePlugin::load('DatabaseLog');
App::uses('CakeLog', 'Log');
CakeLog::config('default', array('engine' => 'DatabaseLog.Database'));
And yet, any request to my app results in a 502 gateway.
I know you'll ask the "is this guy being an idiot questions". So, as a process of elimination:
CakeLog::config('default', array('engine' => 'DatabaseLog.Database'));
results in my app working 100% again2015/03/12 21:48:55 [error] 70781#0: *258 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: dev.katalog.co.za, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "XXXXXX.co.za"
My CakePHP version is 2.6.2
Aaaaany idea what might be causing it?
When I execute all the plugin tests, I get three unwanted, by the test cases produced, debug messages:
D:\dev\xampp\htdocs\cakephp_app\app>console\cake.bat test DatabaseLog AllDatabaseLog - -stderr
Welcome to CakePHP v2.5.6 Console
---------------------------------------------------------------
App : app
Path: D:\dev\xampp\htdocs\cakephp_app\app\
---------------------------------------------------------------
CakePHP Test Shell
---------------------------------------------------------------
PHPUnit 3.7.38 by Sebastian Bergmann.
2014-12-02 23:38:36 Error: x
2014-12-02 23:38:36 Warning: y
2014-12-02 23:38:36 Info: z
............
Time: 2.52 seconds, Memory: 10.00Mb
OK (12 tests, 18 assertions)
Those messages are produced by the following lines, because the objects
aren't mocked:
https://github.com/dereuromark/CakePHP-DatabaseLog/blob/1.0/Test/Case/Lib/Log/Engine/DatabaseLogTest.php#L58
https://github.com/dereuromark/CakePHP-DatabaseLog/blob/1.0/Test/Case/Lib/Log/Engine/DatabaseLogTest.php#L59
https://github.com/dereuromark/CakePHP-DatabaseLog/blob/1.0/Test/Case/Lib/Log/Engine/DatabaseLogTest.php#L60
The solution is to mock the following objects:
https://github.com/dereuromark/CakePHP-DatabaseLog/blob/1.0/Test/Case/Lib/Log/Engine/DatabaseLogTest.php#L35
https://github.com/dereuromark/CakePHP-DatabaseLog/blob/1.0/Test/Case/Lib/Log/Engine/DatabaseLogTest.php#L54
And not use the static calls to CakeLog::write()
.
Which means we can remove the attached test class here:
https://github.com/dereuromark/CakePHP-DatabaseLog/blob/1.0/Test/Case/Lib/Log/Engine/DatabaseLogTest.php#L71
Hi. I'm having trouble using the plugin with the friendsofcake/upload plugin. I'm getting the error below.
Fatal error: Allowed memory size of 2151677952 bytes exhausted (tried to allocate 20480 bytes) in /var/www/mydevsys/vendor/cakephp/cakephp/src/ORM/Marshaller.php on line 75
I tried increasing the memory limit but this increased the execution time and the error persisted. I'm using MySql to log the messages. Please assist.
I'm getting depreciation errors.
CakePHP 3.6.x
Deprecated: DatabaseLog\Model\Table\DatabaseLogsTable::displayField() is deprecated. Use setDisplayField()/getDisplayField() instead. -
C:\xampp\htdocs\pos-certificados\vendor\dereuromark\cakephp-databaselog\src\Model\Table\DatabaseLogsTable.php, line: 46
and
Deprecated: DatabaseLog\Model\Table\DatabaseLogsTable::connection() is deprecated. Use setConnection()/getConnection() instead. -
C:\xampp\htdocs\pos-certificados\vendor\dereuromark\cakephp-databaselog\src\Model\Table\LazyTableTrait.php, line: 56
to be more in sync with the cakephp eco system in general here.
Add a shell command to monitor incoming logs.
Configured can be what type of logs (error, ...) trigger an email to the developer for example or do other alerts of some sort.
A timeout config "interval" (e.g. 2 hours) should prevent too many error mails being generated.
Anything missing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.