Logger Adapter Extension
Logger Adapter Extension
Extension Description
Log output adaptation extension point.
Extension Interface
org.apache.dubbo.common.logger.LoggerAdapter
Extension Configuration
<dubbo:application logger="xxx" />
or:
-Ddubbo:application.logger=xxx
Known Extensions
org.apache.dubbo.common.logger.slf4j.Slf4jLoggerAdapter
org.apache.dubbo.common.logger.jcl.JclLoggerAdapter
org.apache.dubbo.common.logger.log4j.Log4jLoggerAdapter
org.apache.dubbo.common.logger.log4j2.Log4j2LoggerAdapter
org.apache.dubbo.common.logger.jdk.JdkLoggerAdapter
Extension Example
Maven project structure:
src
|-main
|-java
|-com
|-xxx
|-XxxLoggerAdapter.java (implements LoggerAdapter interface)
|-resources
|-META-INF
|-dubbo
|-org.apache.dubbo.common.logger.LoggerAdapter (plain text file, content: xxx=com.xxx.XxxLoggerAdapter)
XxxLoggerAdapter.java:
package com.xxx;
import org.apache.dubbo.common.logger.LoggerAdapter;
public class XxxLoggerAdapter implements LoggerAdapter {
public Logger getLogger(URL url) {
// ...
}
}
XxxLogger.java:
package com.xxx;
import org.apache.dubbo.common.logger.Logger;
public class XxxLogger implements Logger {
public XxxLogger(URL url) {
// ...
}
public void info(String msg) {
// ...
}
// ...
}
META-INF/dubbo/org.apache.dubbo.common.logger.LoggerAdapter:
xxx=com.xxx.XxxLoggerAdapter
Feedback
Was this page helpful?
Yes No
Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)