
Hello, In AppenderAction, there is a line: String appenderName = ec.subst(attributes.getValue(NAME_ATTRIBUTE)); In LoggerAction, this is the equivalent: String loggerName = attributes.getValue(NAME_ATTRIBUTE); The LoggerAction doesn't substitute from context. My guess is that there is a good reason why properties are not substituted in logger names....? That's my question. Here's where this comes from: I thought it would be nifty to route some logs via a shared properties file (shared between the app and logback.xml config) like so: <property resource="logbackProps.properties" /> <logger name="${customLoggerName}> <------------this is what doesn't work because LoggerAction doesn't substitute properties <appender-ref ref="SOME_FILE_APPENDER" /> </logger> Then put a logger name in the logbackProps.properties file: customLoggerName=userAuthLogger Then in code (let's say a user authentication DAO) I could: private static Logger authenticationlogger = LoggerFactory.getLogger(ClassThatGetsProperties.getPropertyValueFor(ConstantsEnum.customLoggerName)); Thanks and Cheers! Eric C

Hi Eric, If you look at LoggerAction from the source repository, you should see that it already does substitution. Cheers, -- Ceki http://twitter.com/#!/ceki On 01/11/2011 4:50 AM, Eric Charlton wrote:
Hello,
In AppenderAction, there is a line: String appenderName = ec.subst(attributes.getValue(NAME_ATTRIBUTE));
In LoggerAction, this is the equivalent: String loggerName = attributes.getValue(NAME_ATTRIBUTE);
The LoggerAction doesn't substitute from context. My guess is that there is a good reason why properties are not substituted in logger names....? That's my question.
Here's where this comes from:
I thought it would be nifty to route some logs via a shared properties file (shared between the app and logback.xml config) like so:
<property resource="logbackProps.properties" />
<logger name="${customLoggerName}> <------------this is what doesn't work because LoggerAction doesn't substitute properties <appender-ref ref="SOME_FILE_APPENDER" /> </logger>
Then put a logger name in the logbackProps.properties file:
customLoggerName=userAuthLogger
Then in code (let's say a user authentication DAO) I could:
private static Logger authenticationlogger = LoggerFactory.getLogger(ClassThatGetsProperties.getPropertyValueFor(ConstantsEnum.customLoggerName));
Thanks and Cheers! Eric C

Thanks Ceki! I see it in 1.0.0 : ) Cheers, Eric C On Nov 1, 2011, at 12:51 AM, ceki wrote:
Hi Eric,
If you look at LoggerAction from the source repository, you should see that it already does substitution.
Cheers, -- Ceki http://twitter.com/#!/ceki
On 01/11/2011 4:50 AM, Eric Charlton wrote:
Hello,
In AppenderAction, there is a line: String appenderName = ec.subst(attributes.getValue(NAME_ATTRIBUTE));
In LoggerAction, this is the equivalent: String loggerName = attributes.getValue(NAME_ATTRIBUTE);
The LoggerAction doesn't substitute from context. My guess is that there is a good reason why properties are not substituted in logger names....? That's my question.
Here's where this comes from:
I thought it would be nifty to route some logs via a shared properties file (shared between the app and logback.xml config) like so:
<property resource="logbackProps.properties" />
<logger name="${customLoggerName}> <------------this is what doesn't work because LoggerAction doesn't substitute properties <appender-ref ref="SOME_FILE_APPENDER" /> </logger>
Then put a logger name in the logbackProps.properties file:
customLoggerName=userAuthLogger
Then in code (let's say a user authentication DAO) I could:
private static Logger authenticationlogger = LoggerFactory.getLogger(ClassThatGetsProperties.getPropertyValueFor(ConstantsEnum.customLoggerName));
Thanks and Cheers! Eric C
logback-dev mailing list logback-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-dev
participants (2)
-
ceki
-
Eric Charlton