Skip to content

Commit

Permalink
Merge pull request #74 from reactivegroup/feature/metrics
Browse files Browse the repository at this point in the history
Feature/metrics
  • Loading branch information
dgzpg authored Dec 5, 2021
2 parents b274662 + 9362192 commit 9bc627e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 19 deletions.
8 changes: 4 additions & 4 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@
</exclusions>
</dependency>
<!-- slf4j -->
<dependency>
<!-- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependency>-->
<!-- logback -->
<!--<dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>-->
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<Configuration status="DEBUG">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<CapaLog4jAppender name="log"/>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console"/>
<AppenderRef ref="log"/>
</Root>
</Loggers>
</Configuration>
<configuration>
<!--Log-->
<appender name="Log" class="group.rxcloud.capa.component.log.CapaLogbackAppenderAgent">
</appender>

<root level="INFO">
<appender-ref ref="Log"/>
</root>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* The agent of the logback impl.
*/
public class CapaLogbackAppenderAgent extends UnsynchronizedAppenderBase<ILoggingEvent> {

/**
* The log component type.
*/
Expand Down Expand Up @@ -53,6 +52,12 @@ public static CapaLogbackAppender buildCapaLogbackAppender() {
CapaLogbackAppender.class);
}

@Override
public void start() {
logbackAppender.doStart();
super.start();
}

/**
* Deal with the log.
*
Expand All @@ -74,6 +79,12 @@ public interface CapaLogbackAppender {
* @param event The log event.
*/
void append(ILoggingEvent event);

/**
*
Do some initialization operations when the appender starts.
*/
void doStart();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@ public TestCapaLogbackAppender() {
public void append(ILoggingEvent event) {
System.out.println("test logback log and content is " + event.getFormattedMessage());
}

@Override
public void doStart() {
System.out.println("Init config...");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ public DemoLogbackAppender() {
public void appendLog(ILoggingEvent event) {
System.out.println("Test logback log and content is " + event.getFormattedMessage());
}

@Override
public void doStart() {
System.out.println("Init config...");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ public void append(ILoggingEvent event) {
}

protected abstract void appendLog(ILoggingEvent event);

@Override
public void doStart() {
// do nothing
}
}

0 comments on commit 9bc627e

Please sign in to comment.