Skip to content
Draft
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
100 changes: 49 additions & 51 deletions audit-client/pom.xml
Original file line number Diff line number Diff line change
@@ -1,66 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<parent>
<groupId>ch.qos.logback</groupId>
<artifactId>audit-parent</artifactId>
<version>0.7-SNAPSHOT</version>
</parent>

<parent>
<groupId>ch.qos.logback</groupId>
<artifactId>audit-parent</artifactId>
<version>0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<modelVersion>4.0.0</modelVersion>
<artifactId>audit-client</artifactId>
<packaging>jar</packaging>
<name>Logback Audit Client</name>

<groupId>ch.qos.logback</groupId>
<artifactId>audit-client</artifactId>
<packaging>jar</packaging>
<name>Logback Audit Client</name>

<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>audit-common</artifactId>
</dependency>

<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>audit-common</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
<reportFormat>plain</reportFormat>
<trimStackTrace>false</trimStackTrace>
<excludes>
<exclude>**/*AllTest.java</exclude>
<exclude>**/PackageTest.java</exclude>
<exclude>**/SizeBasedRollingTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
<reportFormat>plain</reportFormat>
<trimStackTrace>false</trimStackTrace>
<excludes>
<exclude>**/*AllTest.java</exclude>
<exclude>**/PackageTest.java</exclude>
<exclude>**/SizeBasedRollingTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>

</build>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 2006-2011, QOS.ch. All rights reserved.
*
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
*
* or (per the licensee's choosing)
*
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
Expand All @@ -21,24 +21,24 @@

public interface AuditAppender extends ContextAware, LifeCycle {

/**
* Get the name of this appender. The name uniquely identifies the appender.
*/
public String getName();
/**
* Get the name of this appender. The name uniquely identifies the appender.
*/
String getName();

/**
* Set the name of this appender. The name is used by other components to
* identify this appender.
*
*/
public void setName(String name);

/**
* This is where an appender accomplishes its work. Note that the argument
* is of type Object.
* @param event
*/
void doAppend(AuditEvent event) throws AuditException;
/**
* Set the name of this appender. The name is used by other components to
* identify this appender.
*
*/
void setName(String name);

/**
* This is where an appender accomplishes its work. Note that the argument is of
* type Object.
*
* @param event
*/
void doAppend(AuditEvent event) throws AuditException;


}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 2006-2011, QOS.ch. All rights reserved.
*
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
*
* or (per the licensee's choosing)
*
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
Expand All @@ -18,61 +18,62 @@
import ch.qos.logback.audit.AuditException;
import ch.qos.logback.core.spi.ContextAwareBase;

abstract public class AuditAppenderBase extends ContextAwareBase implements
AuditAppender {

protected boolean started = false;

//static final int NOT_STARTED_ERROR_COUNT_LIMIT = 5;
//int notStartedErrorCount = 0;


/**
* Appenders are named.
*/
protected String name;

public synchronized void doAppend(AuditEvent auditEvent)
throws AuditException {

try {

if (!this.started) {
throw new AuditException(
"Attempted to append to non started appender [" + name + "].");
}

// ok, we now invoke derived class' implementation of append
this.append(auditEvent);

} catch (Exception e) {
if (e instanceof AuditException) {
throw (AuditException) e;
} else {
throw new AuditException("Failed to audit an event", e);
}
}
}

abstract protected void append(AuditEvent auditEvent) throws AuditException;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public void start() {
started = true;
}

public void stop() {
started = false;
}

public boolean isStarted() {
return started;
}
abstract public class AuditAppenderBase extends ContextAwareBase implements AuditAppender {

protected boolean started = false;

// static final int NOT_STARTED_ERROR_COUNT_LIMIT = 5;
// int notStartedErrorCount = 0;

/**
* Appenders are named.
*/
protected String name;

@Override
public synchronized void doAppend(final AuditEvent auditEvent) throws AuditException {

try {

if (!started) {
throw new AuditException("Attempted to append to non started appender [" + name + "].");
}

// ok, we now invoke derived class' implementation of append
append(auditEvent);

} catch (final Exception e) {
if (e instanceof AuditException) {
throw (AuditException) e;
}
throw new AuditException("Failed to audit an event", e);
}
}

abstract protected void append(AuditEvent auditEvent) throws AuditException;

@Override
public String getName() {
return name;
}

@Override
public void setName(final String name) {
this.name = name;
}

@Override
public void start() {
started = true;
}

@Override
public void stop() {
started = false;
}

@Override
public boolean isStarted() {
return started;
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 2006-2011, QOS.ch. All rights reserved.
*
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
*
* or (per the licensee's choosing)
*
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/

package ch.qos.logback.audit.client;

public interface AuditConstants {
// TYPES
static final String SUBJECT_TYPE = "SUBJECT_TYPE";
static final String CRUD_TYPE = "CRUD_TYPE";
// CRUD_TYPES
static final String CREATE = "CREATE";
static final String READ = "READ";
static final String UPDATE = "UPDATE";
static final String DELETE = "DELETE";
// TYPES
String SUBJECT_TYPE = "SUBJECT_TYPE";
String CRUD_TYPE = "CRUD_TYPE";

// CRUD_TYPES
String CREATE = "CREATE";
String READ = "READ";
String UPDATE = "UPDATE";
String DELETE = "DELETE";
}
Loading