# Sending false to logger outputs nil?

**URL:** <https://www.ruby-forum.com/t/sending-false-to-logger-outputs-nil/95638>\
**Category:** Ruby\
**Created:** [June 7, 2006, 11:14pm UTC](https://www.ruby-forum.com/t/sending-false-to-logger-outputs-nil/95638 "2006-06-07T23:14:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsanheim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/47e85d/32.png) [@rsanheim](https://www.ruby-forum.com/u/rsanheim)\
**Post date:** [June 7, 2006, 11:14pm UTC](https://www.ruby-forum.com/t/sending-false-to-logger-outputs-nil/95638/1 "2006-06-07T23:14:54Z")

</div>

Am I missing something? Why would sending false to the logger just  
output nil, instead of “false” to correspond to what sending true  
does?

According to the docs: "message can be any object, but it has to be  
converted to a String in order to log it. Generally, inspect is used  
if the given object is not a String. "

This just drove me crazy for a good half hour until I figured out what  
was going on, as I was logging a complex statement that evaluated to a  
boolean…

irb(main):001:0\> require ‘logger’

=\> true  
irb(main):002:0\> logger = Logger.new(STDOUT)  
=\> #\<Logger:0x3307f0 @level=0, @progname=nil,  
@logdev=#\<Logger::LogDevice:0x3307a0 @dev=#IO:0x1e9868,  
@shift\_size=nil, @shift\_age=nil, @filename=nil,  
@mutex=#\<Logger::LogDevice::LogDeviceMutex:0x330778  
@mon\_waiting\_queue=[], @mon\_entering\_queue=[], @mon\_count=0,  
@mon\_owner=nil\>\>, @formatter=nil,  
@default\_formatter=#\<Logger::Formatter:0x3307c8 @datetime\_format=nil\>\>

irb(main):003:0\> logger.debug(true)  
D, [2006-06-07T16:10:23.569265 #5516] DEBUG – : true  
=\> true

irb(main):004:0\> logger.debug(false)  
D, [2006-06-07T16:10:26.721498 #5516] DEBUG – : nil  
=\> true

irb(main):005:0\> logger.info(false)  
I, [2006-06-07T16:10:59.451009 #5516] INFO – : nil  
=\> true

- Rob
