[ruby-core:75004] [Ruby trunk Bug#12238] Logger writes progname if log message is nil

From: sonots@...
Date: 2016-04-18 09:02:28 UTC
List: ruby-core #75004
Issue #12238 has been updated by Naotoshi Seo.


Seems intended, so let me close.
(It is okay to change the behavior, but it looks also okay not to change the behavior)

----------------------------------------
Bug #12238: Logger writes progname if log message is nil
https://bugs.ruby-lang.org/issues/12238#change-58135

* Author: Konstantin /
* Status: Open
* Priority: Normal
* Assignee: Naotoshi Seo
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Please consider the following example:

``` ruby
logger = Logger.new($stdout)

# Log message is nil
logger.info
# I, [2016-03-31T22:04:36.684636 #4019]  INFO -- : nil

logger.progname = 'prog'

# Now log message is changed to progname, is this a bug?
logger.info
# I, [2016-03-31T22:04:51.418510 #4019]  INFO -- prog: prog

logger.info 'test'
# I, [2016-03-31T22:05:03.345434 #4019]  INFO -- prog: test
```

Logger writes progname if log message is nil. Is this a bug or a known feature?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next