Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix Access Logs not working #214

Merged
merged 2 commits into from
May 2, 2023
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id 'java-library'
id 'signing'
id 'maven-publish'
id 'org.springframework.boot' version '3.0.4'
id 'org.springframework.boot' version '3.0.6'
id 'io.spring.dependency-management' version '1.1.0'

// Auto Update Versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
import com.raynigon.ecs.logging.access.AccessLogProperties;
import com.raynigon.ecs.logging.access.context.IAccessLogContext;
import com.raynigon.ecs.logging.access.event.EcsAccessEvent;
import lombok.extern.slf4j.Slf4j;

import java.net.URL;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Logger;

Check notice on line 23 in ecs-logging-access/src/main/java/com/raynigon/ecs/logging/access/logback/AccessLogContext.java

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

ecs-logging-access/src/main/java/com/raynigon/ecs/logging/access/logback/AccessLogContext.java#L23

Unused import - java.util.logging.Logger.

@Slf4j
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7% of developers fix this issue

UnnecessarilyFullyQualified: This fully qualified name is unambiguous to the compiler if imported.


Suggested change
@Slf4j
SuppressWarnings

ℹ️ Expand to see all @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7% of developers fix this issue

UnnecessarilyFullyQualified: This fully qualified name is unambiguous to the compiler if imported.


Suggested change
@Slf4j
LoggerFactory

ℹ️ Expand to see all @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

public class AccessLogContext implements IAccessLogContext, LifeCycle, Context, AppenderAttachable<IAccessEvent> {

private final AccessLogProperties config;
Expand All @@ -31,6 +34,7 @@
private final Map<String, Object> objects;
private final URL configLocation;
private final AppenderAttachableImpl<IAccessEvent> appenderContainer;
private final List<ConfigurationEventListener> eventListeners = new ArrayList<>();
private SequenceNumberGenerator sequenceNumberGenerator;

private ExecutorService executorService;
Expand Down Expand Up @@ -71,14 +75,14 @@
}

public void start() {
executorService = ExecutorServiceUtil.newExecutorService();
executorService = ExecutorServiceUtil.newThreadPoolExecutor();

try {
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(this);
jc.doConfigure(this.configLocation);
} catch (Throwable e) {
//TODO handle exception
log.error("Unable to start access log", e);
}

StatusPrinter.printInCaseOfErrorsOrWarnings(this);
Expand Down Expand Up @@ -163,6 +167,16 @@
this.sequenceNumberGenerator = sequenceNumberGenerator;
}

@Override
public void addConfigurationEventListener(ConfigurationEventListener listener) {
eventListeners.add(listener);
}

@Override
public void fireConfigurationEvent(ConfigurationEvent configurationEvent) {
eventListeners.forEach((listener) -> listener.listen(configurationEvent));
}

public ScheduledExecutorService getScheduledExecutorService() {
throw new UnsupportedOperationException();
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=2.0.1-SNAPSHOT
version=2.1.0-SNAPSHOT
org.gradle.caching=true
Loading