Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
require 'log4r'
require 'log4r/yamlconfigurator'
include Log4r
y = "log4r_config:
# define all loggers ...
loggers:
- name : production
level : INFO
trace : 'false'
outputters:
- stdout
# define all outputters (incl. formatters)
outputters:
- type : StdoutOutputter
name : stdout
formatter:
date_pattern: '%Y-%m-%d %H:%M:%S'
pattern : '%d %l: #\{TEST\} %m '
type : PatternFormatter"
h = YAML.load y
log_cfg = YamlConfigurator
log_cfg['TEST'] = 'foobar'
log_cfg.decode_yaml h['log4r_config']
@log = Logger['production']
@log.info 'test'
#=>2010-05-20 14:36:32 INFO: foobar test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.