Using logger

L

listrecv

Hi. I'm trying to use Ruby's built in logger to show messages with the
severity and timestamp, but I'm just getting the message string, (no
severity or timestamp).

Any suggestions?

(If possible, please cc all responses to me at listrecv at gmail,
thanks!)
=> #<Logger:0x5a04910 @progname=nil,
@logdev=#<Logger::LogDevice:0x5a048b0 @dev=
#<IO:0x48ce7e8>, @shift_size=nil, @shift_age=nil, @filename=nil>,
@level=0, @dat
etime_format=nil>Test
=> trueNoMethodError: undefined method `formatter=' for #<Logger:0x5a04910>
from (irb):138
from :0try again
=> true
 
A

Ara.T.Howard

Hi. I'm trying to use Ruby's built in logger to show messages with the
severity and timestamp, but I'm just getting the message string, (no
severity or timestamp).

Any suggestions?

(If possible, please cc all responses to me at listrecv at gmail,
thanks!)

=> #<Logger:0x5a04910 @progname=nil,
@logdev=#<Logger::LogDevice:0x5a048b0 @dev=
#<IO:0x48ce7e8>, @shift_size=nil, @shift_age=nil, @filename=nil>,
@level=0, @dat
etime_format=nil>
Test
=> true
NoMethodError: undefined method `formatter=' for #<Logger:0x5a04910>
from (irb):138
from :0
try again
=> true

which ruby version? this certainly works for me:

harp:~ > ruby -r logger -e' Logger::new(STDOUT).info 42 '
I, [2005-11-13T17:51:50.496175 #5158] INFO -- : 42

harp:~ > ruby -r logger -e' Logger::new(STDOUT).info{ 42 } '
I, [2005-11-13T17:51:57.527556 #5159] INFO -- : 42



-a
--
===============================================================================
| ara [dot] t [dot] howard [at] gmail [dot] com
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================
 
N

NAKAMURA, Hiroshi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

which ruby version? this certainly works for me:

It should be ruby-1.8.2 or earlier. Logger#formatter= is from ruby-1.8.3.

Unfortunately some library/application ruins original logger.rb.
Adding the following line may recover the original logger.rb definition
(with some warnings).

load "logger.rb"

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFDeHj6f6b33ts2dPkRAg7yAJ97Zsd+mhYacOioWU52e/LdhFsZQwCcCGJI
n/PJY4kT6tJ8/h805Qlis64=
=fxOa
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top