First open log4j.properties file (
log4j.category.SERVICE_LOGGER.TestLogProxy=INFO, PROXY_APPENDER log4j.additivity.PROXY_APPENDER=false log4j.appender.PROXY_APPENDER=org.apache.log4j.DailyRollingFileAppender log4j.appender.PROXY_APPENDER.File=${carbon.home}/repository/logs/${instance.log}/testlogproxy${instance.log}.log log4j.appender.PROXY_APPENDER.Append=true log4j.appender.PROXY_APPENDER.layout=org.apache.log4j.PatternLayout log4j.appender.PROXY_APPENDER.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%X{ip}-%X{host}] [%t] %5p %c{1} %m%
In here, 'TestLogProxy' is the name of the proxy service. You can define a location as the value for 'log4j.appender.PROXY_APPENDER.File' property. I have used default path for logs ( ${carbon.home}/repository/logs/) in here.
Then create a proxy service with log mediator ( log category – Info and log level – Full ) and add a send mediator with a service endpoint. You can see the customized log file under specified log path and logs for the 'TestLogProxy' will be logged in this file.