Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}