[logback-user] Richer logconfiguration naming scheme

Urs Peter peter.urs at gmail.com
Mon Apr 11 16:00:40 CEST 2011


Hi all,

Recently I was reinventing once more a strategy to deal with different
logging configurations based on environment. Logback offers a rather
rigid approach by means of the -test naming scheme, which provides me
with two options for logging configuration: one for real and one for
test. For my usage, I'm looking for a richer naming scheme.

Since I recently did some stuff with lift where they - in my eyes -
found an elegant way to tackle this problem, I thought it might be
handy to port this to logback. What lift does is the following: They
use a naming scheme, which combines a run mode, and/or current user
and/or host. Their convention looks as follows:

> modeName.userName.hostName.props
>
> examples:
> jack.aserver.props
> test.jack.aserver.props
> production.aserver.props
> staging.jack.props
> test.default.props
> default.props


The run mode (test/production/staging etc.) is nothing else than an
JVM argument (-Drun.mode=test). The current user is related to the
user.name default JVM argument.

What do you guys think, would this be an interesting feature?

Cheers Urs


More information about the Logback-user mailing list