[logback-user] Variable substitution for logger name?

Mark.Boatman at securian.com Mark.Boatman at securian.com
Fri Mar 1 16:43:48 CET 2013


Is it possible to use variable substitution with the <logger name>?

Here is my configuration xml.  Everything works EXCEPT this:  <logger name
=${appLoggerPrefix} level="INFO">

Is that not allowed?

<?xml version="1.0" encoding="UTF-8" ?>

<configuration debug="true">
        <property resource=
"com/minnesotamutual/corp/compliance/end/config/app.properties" />
        <property name="LOGS_PATH" value=
"${com.minnesotamutual.appLogs}/${appName}/" />
        <property name="SPRING_LOG_BASE_FILENAME" value=
"${appName}-spring" />
        <property name="APP_LOG_BASE_FILENAME" value="${appName}-app" />
 
        <appender name="SpringLogFileAppender" class=
"ch.qos.logback.core.rolling.RollingFileAppender">
                <file>${LOGS_PATH}${SPRING_LOG_BASE_FILENAME}.log</file>
                <rollingPolicy class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                        <fileNamePattern>
${LOGS_PATH}${SPRING_LOG_BASE_FILENAME}-%d{yyyy-MM-dd}.log</
fileNamePattern>
                        <maxHistory>30</maxHistory>
                </rollingPolicy>
                <encoder>
                        <pattern>%date [%level] at line %line in 
%class[%method]: %msg%n</pattern> 
                </encoder>
        </appender>
 
        <appender name="AppLogFileAppender" class=
"ch.qos.logback.core.rolling.RollingFileAppender">
                <file>${LOGS_PATH}${APP_LOG_BASE_FILENAME}.log</file>
                <rollingPolicy class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                        <fileNamePattern>
${LOGS_PATH}${APP_LOG_BASE_FILENAME}-%d{yyyy-MM-dd}.log</fileNamePattern>
                        <maxHistory>30</maxHistory>
                </rollingPolicy>
                <encoder>
                        <pattern>%date [%level]: %msg%n</pattern> 
                </encoder>
        </appender>
 
        <logger name=${appLoggerPrefix} level="INFO">
                <appender-ref ref="AppLogFileAppender" />
        </logger>
 
        <logger name="org.springframework" level="INFO">
                <appender-ref ref="SpringLogFileAppender" />
        </logger>
 
        <root level="INFO">
        </root>




Mark E. Boatman, FLMI
Applications Consultant, Corp/PFC/Inv Systems, Information Technology  • 
Securian Financial Group
400 Robert Street North  •  A9-4949  •  St. Paul, MN 55101-2098
651-665-4949
mark.boatman at securian.com  •  www.securian.com

Securian Financial Group – Financial security for the long run ® 


This email transmission and any file attachments may contain confidential 
information intended solely for the use of the individual or entity to 
whom it is addressed. If you have received this email message in error, 
please notify the sender and delete this email from your system. If you 
are not the intended recipient, you may not disclose, copy, or distribute 
the contents of this email.   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130301/6097562f/attachment-0001.html>


More information about the Logback-user mailing list