I am using logback v1.1.3 with my deployed Weblogic application.  I am trying 
to log client ip address along with the xForwaredFor IP address.  I added the 
MDC filter to the application deployment web.xml file and modified the 
logback.xml file.  The log output correctly displays the xForwardedFor IP 
address.  However, I am getting a PARSER_ERROR for the client ip (IP=%h).    
Any ideas on logging the request source IP?

Thanks

Here is my configuration:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
        <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
                <encoder 
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                        <pattern>%d %-5p [IP=%h  %X{req.remoteHost} 
%X{req.requestURI} External IP=%X{req.xForwardedFor}] - %msg%n</pattern>
                </encoder>
        </appender>

        <appender name="LOGFILE" 
class="ch.qos.logback.core.rolling.RollingFileAppender">
            <File>applogs/${weblogic.Name}.log</File>
                <!--<pattern>%d [%thread] %-5p - %msg%n</pattern>-->
                <encoder 
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                        <pattern>%d %-5p [IP=%h  %X{req.remoteHost} 
%X{req.requestURI} External IP=%X{req.xForwardedFor}] - %msg%n</pattern>
                </encoder>
            <rollingPolicy 
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                
<FileNamePattern>applogs/${weblogic.Name}-%d{yyyy-MM-dd}.log.%i.gz</FileNamePattern>
                <timeBasedFileNamingAndTriggeringPolicy 
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                    <maxFileSize>25MB</maxFileSize>
                </timeBasedFileNamingAndTriggeringPolicy>
                <!-- Keep 3 days' worth of history -->
                <maxHistory>3</maxHistory>
            </rollingPolicy>
        </appender>

        <root level="DEBUG">
            <appender-ref ref="CONSOLE"/>
            <appender-ref ref="LOGFILE"/>
        </root>
</configuration>

----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may 
contain information that is privileged, confidential and/or proprietary and 
subject to important terms and conditions available at 
http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended 
recipient, please delete this message.
_______________________________________________
logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to