nettrine/orm – vypnuti logu SQL dotazů do debug.log

motorcb
Člen | 552
+
0
-

Zdravím,

rozběhnul jsem nettrine/orm ale na webhostingu mi to loguje všechny SQL dotazy do souboru /log/debug.log
Jde to nějak vypnout? Docela to bobtná :-)

common.neon:

parameters:
	database:
		driver: pdo_mysql
		host: localhost
		dbname: aaa
		user: bbb
		password: ccc

application:
	errorPresenter: Error
	mapping:
		*: [App, Modules\*, Presenters\*Presenter]

database:
	dsn: '%database.driver%:host=%database.host%;dbname=%database.dbname%'
	user: %database.user%
	password: %database.password%

session:
	expiration: 14 days

# Extension > Nettrine
extensions:
	contributte.monolog: Contributte\Monolog\DI\MonologExtension
	nettrine.annotations: Nettrine\Annotations\DI\AnnotationsExtension
	nettrine.cache: Nettrine\Cache\DI\CacheExtension
	nettrine.migrations: Nettrine\Migrations\DI\MigrationsExtension
	nettrine.fixtures: Nettrine\Fixtures\DI\FixturesExtension

	# Dbal
	nettrine.dbal: Nettrine\DBAL\DI\DbalExtension
	nettrine.dbal.console: Nettrine\DBAL\DI\DbalConsoleExtension(%consoleMode%)

	# Orm
	nettrine.orm: Nettrine\ORM\DI\OrmExtension
	nettrine.orm.cache: Nettrine\ORM\DI\OrmCacheExtension
	nettrine.orm.console: Nettrine\ORM\DI\OrmConsoleExtension(%consoleMode%)
	nettrine.orm.annotations: Nettrine\ORM\DI\OrmAnnotationsExtension

nettrine.dbal:
	debug:
		panel: %debugMode%
	configuration:
		sqlLogger: Nettrine\DBAL\Logger\PsrLogger(@Monolog\Logger)
	connection:
		driver: %database.driver%
		host: %database.host%
		user: %database.user%
		password: %database.password%
		dbname: %database.dbname%
		charset:  UTF8

nettrine.orm:
	entityManagerDecoratorClass: App\Model\Database\EntityManager
	configuration:
		autoGenerateProxyClasses: %debugMode%

nettrine.orm.annotations:
	mapping:
		App\Model\Database\Entity: %appDir%/Model/Database/Entity

nettrine.migrations:
	table: doctrine_migrations
	column: version
	directory: db/Migrations
	namespace: Database\Migrations
	versionsOrganization: null

nettrine.fixtures:
	paths:
		- /db/Fixtures

decorator:
	Doctrine\Common\EventSubscriber:
		tags: [nettrine.subscriber]

services:
	- Nettrine\Migrations\Subscriber\FixPostgreSQLDefaultSchemaSubscriber

contributte.monolog:
	holder:
		enabled: true
	channel:
		default:
			handlers:
				- Monolog\Handler\RotatingFileHandler(%appDir%/../log/syslog.log, 30, Monolog\Logger::WARNING)
			processors:
				- Monolog\Processor\WebProcessor()
				- Monolog\Processor\IntrospectionProcessor()
				- Monolog\Processor\MemoryPeakUsageProcessor()
				- Monolog\Processor\ProcessIdProcessor()

Díky

Felix
Nette Core | 1245
+
0
-

Ahoj. Vychazel jsi z nejakeho skeletonu nebo jsi to sestavil sam?

motorcb
Člen | 552
+
0
-

Felix napsal(a):

Ahoj. Vychazel jsi z nejakeho skeletonu nebo jsi to sestavil sam?

Sestavil sám :-)

Felix
Nette Core | 1245
+
+3
-

Rozumim. Je potreba vypnout provazani monologu z tracy.

monolog:
	hook:
		toTracy: false

contributte/monolog lze nastavit tak, ze cokoli loguje tracy, tak jde poslat do monologu a obracene. Tyhle hooky jsou zapnute by default. Lze je vypnout pres monolog.hook.toTracy.

motorcb
Člen | 552
+
+1
-

Paráda. Diky! Máš u mne pivo. Zafungovalo:

contributte.monolog:
	hook:
		toTracy: false
Martin Vágovszký
Člen | 17
+
+1
-

Ahoj, mě pomohlo zakomentovat sqlLogger:

nettrine.dbal:
	debug:
		panel: %debugMode%
	#configuration:
	#	sqlLogger: Nettrine\DBAL\Logger\PsrLogger(@Monolog\Logger)
fistaro
Člen | 3
+
0
-

Ahoj, da se to nejak vypnout i v pripade pd/monolog ?

Felix
Nette Core | 1245
+
0
-

V nove verzi funguje logovani jinak, pouzivaji se tzn. Middlewares (https://www.doctrine-project.org/…tecture.html#…).

Nettrine je ready, doporucuju mrknout do dokumentace.