现在,我在Rails中使用log4r作为记录器来打印文件名和行号:
======== config/log4r.yml ========
log4r_config:
# define all loggers:
loggers:
- name : rails
level : DEBUG
trace : 'true'
outputters :
- console
# define all outputters (incl. formatters)
outputters:
- type: StdoutOutputter
name: console
formatter:
date_pattern: '%Y-%m-%d %H:%M:%S'
pattern : '%d %l %t : %m'
type : PatternFormatter
然而,它打印文件路径而不是文件名,并且它太长了:
2015-12-23 18:05:37 INFO /Users/fudy/Workspace/RubyWorkspace/HelloWorld/app/controllers/welcome_controller.rb:3: in `index' : hello
但我想要这种格式:
2015-12-23 18:05:37 INFO welcome_controller.rb:3: hello
有没有解决方案?