# Howto configure logging via yaml

**URL:** <https://www.ruby-forum.com/t/howto-configure-logging-via-yaml/180195>\
**Category:** Ruby\
**Created:** [December 14, 2009, 2:48pm UTC](https://www.ruby-forum.com/t/howto-configure-logging-via-yaml/180195 "2009-12-14T14:48:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohplease](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohplease](https://www.ruby-forum.com/u/ohplease)\
**Post date:** [December 14, 2009, 2:48pm UTC](https://www.ruby-forum.com/t/howto-configure-logging-via-yaml/180195/1 "2009-12-14T14:48:17Z")

</div>

Hi there,

I am new to both ruby an yaml and i am unsuccessfully trying to setup a  
logging configuration. (using logging-1.2.3)

As there is neither an example nor a specification of the  
“logging\_config” structure I have to guess from the source. But I cannot  
make hands or tails out of it (appenders expects an array(Appender) of  
arrays(name+config?!? - should name be an option?)). Can someone post an  
(nontrivial) example or elaborate on the structure?

Regards,  
Holger

---

<div class="post-metadata">

**Author:** ![ohplease](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohplease](https://www.ruby-forum.com/u/ohplease)\
**Post date:** [December 14, 2009, 3:45pm UTC](https://www.ruby-forum.com/t/howto-configure-logging-via-yaml/180195/2 "2009-12-14T15:45:41Z")

</div>

Okay, meanwhile I got it:

Here an example for other seekers 🙂

# set global logging to “info”

# add another level called remark

# create a logger named “main” logging warnings

# log everything to stderr like this

# “hh:mm:ss LEVEL main: messsage”

logging\_config:  
pre\_config:  
define\_levels: [debug, info, remark, warn, error, fatal]  
appenders:

- name: app1  
type: Stderr  
layout:  
type: Pattern  
pattern: “%d %-7l %4c: %m\n”  
date\_pattern: %H:%M:%S  
loggers:
- name: root  
level: info  
appenders:
  - app1

- name: main  
level: warn

Regards,  
Holger
