Ok found the solution to this,

You simply need to add the *additivity* property with the value false as
follows,

log4j.logger.org.apache.synapse.transport.http.wire=DEBUG, WIRE_LOGFILE
log4j.*additivity*.org.apache.synapse.transport.http.wire=*false*


This will prevent the log request from propagating up the hierarchy of
parent loggers(and the log4j.rootLogger in this case). So it will only be
handled by the WIRE_LOGFILE appender and be written to
<ESB_HOME>/repository/logs/wso2wire.log
without being sent to other appenders(such as the CARBON_LOGFILE appender
which is responsible for writing the wso2carbon.log)


On 10 June 2015 at 12:37, Uvindra Dias Jayasinha <uvin...@wso2.com> wrote:

> I've defined a custom appender in the log4j.properties of ESB 4.8.1 as
> follows.
>
>
> # WIRE_LOGFILE is set to be a DailyRollingFileAppender using a
> PatternLayout.
>
> log4j.appender.WIRE_LOGFILE=org.wso2.custom.logging.appenders.WireDailyRollingFileAppender
> # Log file will be overridden by the configuration setting in the DB
> # This path should be relative to WSO2 Carbon Home
>
> log4j.appender.WIRE_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2wire${instance.log}.log
> log4j.appender.WIRE_LOGFILE.Append=true
>
> log4j.appender.WIRE_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
> # ConversionPattern will be overridden by the configuration setting in the
> DB
> log4j.appender.WIRE_LOGFILE.layout.ConversionPattern=TID: [%T] [%S] [%d]
> %P%5p {%c} - %x %m {%c}%n
> log4j.appender.WIRE_LOGFILE.layout.TenantPattern=%U%@%D [%T] [%S]
> log4j.appender.WIRE_LOGFILE.threshold=DEBUG
>
>
> Then I associated the wire logs entry with this appender,
>
> log4j.logger.org.apache.synapse.transport.http.wire=DEBUG, WIRE_LOGFILE
>
>
> So now when I invoke the Echo service of ESB the wire logs are getting
> printed to <ESB_HOME>/repository/logs/wso2wire.log file as expected.
>
>
> But its also getting printed in the wso2carbon.log, this is what I don't
> want. So how do I stop the wire log from getting printed in the
> wso2carbon.log?
>
>
> --
> Regards,
> Uvindra
>
> Mobile: 777733962
>



-- 
Regards,
Uvindra

Mobile: 777733962
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to