Access Log

Config dubbo access log

If you want to log the access information for each provide service,you can turn on the accesslog switch,which like the access log of Apache.

Logging by logging framework

<dubbo:protocol accesslog="true" .../>

The above configuration will turn on accesslog switch for all provide services,and logging the access log with logging framework(log4j/logback/slf4j…).You can config the logging framework of logger and appender for logging the access log.The simplest way is config logger name with dubbo.accesslog. The Example:

<appender name="accesslogAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern><![CDATA[%level|%d{yyyy-MM-dd HH:mm:ss}|%m%n}]]></pattern>
<logger name="dubbo.accesslog" level="INFO" additivity="false">
        <appender-ref ref="accesslogAppender"/>

The above is the demonstration of logback framework.Other logging framework is same too. It will logging the access log of all provide services into single file(accesslog/logging.log). And you can also config the access log of each provide service to logging separately,Only change name attribute of the logger tag,set the name attribute to dubbo.accesslog.serviceInterfaceClassFullName.The Example:

<logger name="" level="INFO" additivity="false">
        <appender-ref ref="fooServiceAccesslogAppender"/>

If you only want logging the access log of specified provide service,but not all services, it’s supported too.The Example:

<dubbo:service accesslog="true" .../>

Logging by specified file path

You can specify the file path with the accesslog attribute.The Example:

<dubbo:protocol accesslog="/home/admin/logs/service/accesslog.log" .../>


<dubbo:service accesslog="/home/admin/logs/service/accesslog.log" .../>

Last modified December 22, 2020: clean up website (6e41905afab)