[Solved] Hide SQL logs in rails console

automate

#1

Hello experts,

I’m experimenting with rails console and wonder if I can disable/hide SQL logs like these:

irb(main):047:0> vmname = $evm.vmdb(:vm, 8).name rescue nil
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0
=> "cf-vm"

#2

That should only happen on first connection, but I think you can disable it. @jrafanie do you remember how or if it’s possible?


#3

@xian It’s defined here and is a rails debug message so you only see it in development mode or with level_rails in manageiq set to debug.

If you change Rails.logger.level = 1 in rails console, you’ll silence queries and this connection checkout/checkin logging.


#4

Thanks @jrafanie, that helped.
@Fryguy - it happened multiple times (as above) even after repeating the same command.