Search code examples
rubymockserver

How to turn off logging into the console in Mockserver Ruby client


I am creating an expectation using the Ruby client for mockserver and getting a bunch of logging messages in the console(terminal). I was wondering how to turn that off, but not print it out to a file.

I have tried this but it only prints it out to a file

client = MockServerClient.new(Config.mockserver.host, Config.mockserver.port)
client.logger = LoggingFactory::DEFAULT_FACTORY.log('yo', output: 'tmp.log', truncate: true)

Solution

  • You can chose whichever of these.

    • Logging in console: client.logger = Logger.new(STDOUT)

    • Logging into file: client.logger = Logger.new('log/foo.log', 'daily')

    • Logging nothing: client.logger = Logger.new(nil)