# Logging 0.9.0 (the "Monkeyful Chimptacular" release)

**URL:** <https://www.ruby-forum.com/t/logging-0-9-0-the-monkeyful-chimptacular-release/143300>\
**Category:** Ruby\
**Created:** [July 17, 2008, 3:29am UTC](https://www.ruby-forum.com/t/logging-0-9-0-the-monkeyful-chimptacular-release/143300 "2008-07-17T03:29:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [July 17, 2008, 3:29am UTC](https://www.ruby-forum.com/t/logging-0-9-0-the-monkeyful-chimptacular-release/143300/1 "2008-07-17T03:29:49Z")

</div>

logging version 0.9.0  
by Tim P.  
[http://logging.rubyforge.org/](http://logging.rubyforge.org/)  
(the “Monkeyful Chimptacular” release)

== DESCRIPTION

Logging is a flexible logging library for use in Ruby programs based  
on the  
design of Java’s log4j library. It features a hierarchical logging  
system,  
custom level names, multiple output destinations per log event, custom  
formatting, and more.

== CHANGES

2 minor enhancement

- Exceptions from appenders are captured and logged
- Internal logger for the Logging framework (disabled by default)
- Added a DSL configuration format (more readable than YAML)  
1 bug fix
- Modules could not have their own logger instance

Blessings,  
TwP

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [July 17, 2008, 9:03am UTC](https://www.ruby-forum.com/t/logging-0-9-0-the-monkeyful-chimptacular-release/143300/2 "2008-07-17T09:03:25Z")

</div>

Tim P. wrote:

> logging version 0.9.0
> 
> Blessings,  
> TwP

require ‘logging’

logger = Logging::Logger[‘example\_logger’]  
logger.add\_appenders(  
Logging::Appender.stdout,  
Logging::Appenders::File.new(‘example.log’)  
)  
logger.level = :info

logger.debug “this debug message will not be output by the logger”  
logger.info “just some friendly advice”

Base on the sample above, how do I configure different log level for 2  
output. Eg I want the stdout to be :info level bug the logfile to be  
:debug level. Is this possible?

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [July 17, 2008, 11:32am UTC](https://www.ruby-forum.com/t/logging-0-9-0-the-monkeyful-chimptacular-release/143300/3 "2008-07-17T11:32:02Z")

</div>

hi!

Shin guey Wong [2008-07-17 08:58]:

> logger.info “just some friendly advice”
> 
> Base on the sample above, how do I configure different log level for 2  
> output. Eg I want the stdout to be :info level bug the logfile to be  
> :debug level. Is this possible?  
> you can set the log level on the appender individually:

logger = Logging::Logger[‘example\_logger’]  
logger.add\_appenders(  
Logging::Appenders::Stdout.new(nil, :level =\> :info),  
Logging::Appenders::File.new(‘example.log’)  
)  
logger.level = :debug

but note that you can only set _higher_ thresholds on the appenders,  
events below the log level of the superordinate logger instance  
won’t be passed through to the appenders, AFAIK. tim, please correct  
me if i’m wrong 😉

cheers  
jens

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [July 17, 2008, 4:42pm UTC](https://www.ruby-forum.com/t/logging-0-9-0-the-monkeyful-chimptacular-release/143300/4 "2008-07-17T16:42:19Z")

</div>

On Jul 17, 2008, at 3:26 AM, Jens W. wrote:

> > logger.level = :info  
> > logger = Logging::Logger[‘example\_logger’]  
> > logger.add\_appenders(  
> > Logging::Appenders::Stdout.new(nil, :level =\> :info),  
> > Logging::Appenders::File.new(‘example.log’)  
> > )  
> > logger.level = :debug
> 
> but note that you can only set _higher_ thresholds on the appenders,  
> events below the log level of the superordinate logger instance  
> won’t be passed through to the appenders, AFAIK. tim, please correct  
> me if i’m wrong 😉

That is correct. If your logger level is set to ‘error’ then only  
error and fatal log events will be propagated to the appenders.

But you can configure appenders individually to drop log events below  
a certain threshold. For the example above …

Logging::Appender[‘stdout’].level = :info  
Logging::Appender[‘exmaple.log’].level = :debug

And you would need to set the logger level to :debug to see any  
difference between the output of the two appenders.

logger.level = :debug

Just FYI – you can access an Appender or Logger by name if they have  
already been created:

Logging::Logger[‘example\_logger’] #=\> always returns the same  
logger instance  
Logging::Appender[‘stdout’] #=\> always returns the stdout  
appender if it has been created

Blessings,  
TwP
