1

How to enable {all type of, not just slow} query logging to FILE in MariaDB Server version: 10.4.11 running on Windows 10 ? I have modified my.ini file and added these line at the bottom but it did not worked

[mariadb]
log_output=FILE
general_log
general_log_file=queries.log

I have executed the same in console too with admin privilege but nothing happened, no error was either produced.

Sourav
  • 17,065
  • 35
  • 101
  • 159
  • 1
    `general_log` should be set to `0` for no log, or to `1` for logging. You need to change it to `general_log=1` ( [docs](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_general_log) ) – Luuk Dec 19 '20 at 13:09
  • @Luuk already tried that, but no effect – Sourav Dec 19 '20 at 13:10
  • 1
    With the settings you provided, the file should be created in de `datadir` (use `show variables like '%datadir%';` to show where that is) – Luuk Dec 19 '20 at 13:25
  • 2
    And, you should check if the variables are set with `show variables like '%general%';` (because it is easy to change the wrong my.ini or my.cnf file....) – Luuk Dec 19 '20 at 13:28

2 Answers2

3

If you are using wamp server on windows 10.

Open my.ini file located in C:\wamp64\bin\mariadb\mariadb10.4.10\my.ini

Add the below code at the bottom of this file It will enable slow query logging to the file.

[mariadb]
slow_query_log=1
log_output=FILE
slow_query_log_file=c:/wamp64/logs/mariadb_slow.log
long_query_time=2
log_queries_not_using_indexes=ON

Restart MariaDB service to apply these changes. Reference https://mariadb.com/kb/en/slow-query-log-overview/

MaYaNk
  • 392
  • 1
  • 7
  • 16
1

Added at the bottom of my.ini and restarted MySQL

[mariadb]
general_log=1
log_output=FILE
general_log_file=queries.log

File created under mysql\data\queries.log

Sourav
  • 17,065
  • 35
  • 101
  • 159