How to log all Doctrine queries to file? - doctrine

I'm using Doctrine and want to log all generated SQL queries.
I know that I could use $q->getSqlQuery() but I don't want to do that manually each time.
Is there a way to do it automatically?

If you turn logging on all queries shoudl be logged to your application log in the log directory. To do this set logging_enabled to true in your settings.yml.

Take a look at Doctrine Profiler and the source of ZF_Debug & Doctrine.

Related

How to see the all queries ran from Kibana Dev tool

If want to see, all the ran queries, from Kibana Dev tool, how to see it? Is there any query, which shows all the ran queries may be for last 30 days?
I guess there is no Api for showing history of executed queries how ever you can find the related log files in var/log/elasticsearch file path More over if you want to always keep record of all executed queries and events in your Dev tools you can create and index for it and use Logstash to insert your operation logs(which previously said where is stored) into that index.

Logging CockroachDB queries

I have an application running CockroachDB on AWS and want to log all of the queries it executes. However, I can’t find anything in my cluster’s logs that seems to contain the queries. I tried grepping through them for my application’s SELECT statements but can’t find them.
Is there a way to enable query logging?
The other answer is outdated. There are two mechanisms:
for regular inspection/troubleshooting, one should use SQL statement execution logging as documented here: https://www.cockroachlabs.com/docs/stable/query-behavior-troubleshooting.html#cluster-wide-execution-logs
for access audits (when required for e.g. regulation) use audit logging: https://www.cockroachlabs.com/docs/stable/sql-audit-logging.html
When starting a node with cockroach start, include the --vmodule=executor=2 flag to log all SQL queries. For example:
cockroach start --background --vmodule=executor=2
You can access the logs then from the log files stored in cockroach-data/logs
If you’re curious about logging queries that run “too long”, set the env var COCKROACH_TRACE_SQL to a duration to log all queries longer than that duration.
One can also activate this logging after starting the server by accessing the URL http://[admin UI URL]/debug/vmodule/executor=2 using the same host/port as the admin UI.

How to clear cache in Pentaho

I am using Pentaho 5. My dimensions keep changing frequently and I need the changes to be applied to the dashboard, this is not possible because Pentaho keeps caching. I have created the cube using the datasource wizard and the querys using mdx over mondrian jndi. Even though I set the property Cache to false or set cache duration doesn't seem to work. Is there a API that I can use with mondrian jndi to clear cache? Or are there any property files that I should change? Please help.
In Pentahoo 7 the "Clear Cache" option is in a different Menu:
Tools -> Database -> Clear Cache
If you are using Database lookup and if you are getting older fields, cleaning cache can actually solved the problem.
It worked for me.
You can do it manually inside Pentaho User Console: Tools -> Refresh -> Mondrian Schema Cache.
Or you can make schedule for refreshing cache: find clear_mondrian_schema_cache.xaction inside your installation and schedule it.
Option 1:
You can read http://javadoc.pentaho.com/bi-platform500/webservice500/ for api details.
And also you can refresh Reporting Metadata Cache via web service, you can use the following web service call:
http://localhost:8080/pentaho/api/system/refresh/metadata
Option2: You can navigate to \biserver-ee\tomcat\webapps\pentaho\WEB-INF\classes
and change the configuration file "ehcache.xml"
<cache name="report-dataset-cache"
maxElementsInMemory="50"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="1"
timeToLiveSeconds="2"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="1"
/>
If you have done that and still no positive answer, I think you have not restarted the BA server. If the issue still exists comment below.
There are 2 options
One is to schedule "clear mondrian schema" on ba server but for that to happen , you need to get clear_mondrian_schema.xml from pentaho-solutions/systems folder and upload it in some folder that you can access on ba server. You can then use normal schedule file options to achieve you want. This put a lof of load on BA server though.
My second recommendation is if you are using cubes/schema and building using schema workbench, you can turn the caching off. If your database is architecturally good and your schemas all well defined, user will get updates/new data as soon as they refresh.

How to profile Doctrine MongoDB ODM?

How can I profile Doctrine MongoDB ODM?
I would like to see all queries against database and the time of execution. Is there any way to configure a profiler? I would like to build a plugin that I would use it in ZFDebug toolbar.
The MongoDBODMModule for ZF2 may have some classes you could re-use to handle this problem in ZF1. If you're already using ZF2, then it is just a matter of installing the module and ZendDeveloperTools to have the toolbar.
MongoDB has its own profiler, check http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/

Is it possible to log all operation, automatically?

Is it possible to log all operation on specific table? For example, any row insertion/update/delete are logged automatically. That log should only readable/writable by admin.
You should be able to do so using TRIGGERS:
http://h2database.com/html/features.html#triggers
H2 allows for "injecting" Java classes as triggers, which makes logging of particular events quite simple and extensible

Resources