Comments (4)
Hello @denisVitonis ,
I noticed the same problem. I have no idea where exactly the reason. But I am thinking of updating this code. When I solve the issue, I will note here.
If you can find a solution to this issue, I would be glad if you can share it with me.
Thanks
from ci_log_query.
Dear Ozan, I managed to solve it in another way, however using your hook.
First and I created a helper.
with the function
////////////CODE IN helper FILE***//////////////////////////
function log_queries_2($sql) {
$filepath = APPPATH . 'logs/Query-log-' . date('Y-m-d') . '.php';
$handle = fopen($filepath, "a+");
fwrite($handle, $sql." \n Execution Time: ".date("Y-m-d H:i:s")."\n\n");
fclose($handle);
}
//////////////**************************///////////////////
After this go to system/database/DB_driver.php and find function named "query" and put this below code on top inside the function.
It may not be the best of good practices but it works perfectly.
////////////CODE IN DB_driver.php FILE***//////////////////////////
log_queries_2($sql);'
//////////////**************************///////////////////
from ci_log_query.
Dear Ozan, I managed to solve it in another way, however using your hook.
First and I created a helper.
with the function
////////////CODE IN helper FILE***//////////////////////////
function log_queries_2($sql) {
$filepath = APPPATH . 'logs/Query-log-' . date('Y-m-d') . '.php';
$handle = fopen($filepath, "a+");
fwrite($handle, $sql." \n Execution Time: ".date("Y-m-d H:i:s")."\n\n");
fclose($handle);
}
//////////////**************************///////////////////
After this go to system/database/DB_driver.php and find function named "query" and put this below code on top inside the function.
It may not be the best of good practices but it works perfectly.////////////CODE IN DB_driver.php FILE***//////////////////////////
log_queries_2($sql);'//////////////**************************///////////////////
this solution is not the right approach. Because if you want to be able to update Codeigniter, you should never make changes under the system folder.
I have made some code fixes but this problem is still not resolved.
I'm still investigating this problem. If I can find a solution, I want to update it as soon as possible.
from ci_log_query.
I solved this problem. Actually, this was not an error.
The code runs correctly and actually writes INSERT, UPDATE, DELETE queries to the log file.
However, this code only works on "post_controller" (Called immediately after your controller is fully executed). You can read the details of this from the link.
You are probably doing a redirect after doing INSERT, UPDATE, DELETE operations like me. The controller cannot be completed if it contains redirecting. No database queries can be written to the log file because the operation could not be completed.
P.S.: My English is not very good. I apologize for this.
from ci_log_query.
Related Issues (2)
- INSERT OR UPDATE QUERIES HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ci_log_query.