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

#404: enhance logging with custom slf4j bridge #1017

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7af9fc5
#765: Fix typos in DoD asciidoc
Oct 2, 2024
aeae1dd
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 17, 2024
e520d16
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 25, 2024
29403d3
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 25, 2024
5bff5eb
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 28, 2024
890c107
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 29, 2024
c55af62
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Oct 31, 2024
5224bf9
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 7, 2024
d925977
Merge branch 'main' of https://github.com/KianRolf/IDEasy
KianRolf Nov 8, 2024
8921a0c
Testprovider
KianRolf Nov 11, 2024
6a139b3
extension
KianRolf Nov 11, 2024
fcf4a64
draft pr
KianRolf Nov 13, 2024
e2b1c2b
fix
KianRolf Nov 13, 2024
648c65a
Merge branch 'main' into enhance/404-logging-concept
KianRolf Nov 13, 2024
22b59be
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Nov 14, 2024
5e1ce87
Merge branch 'main' into enhance/404-logging-concept
KianRolf Nov 14, 2024
a9ffba2
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Nov 18, 2024
c15e0d1
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Nov 19, 2024
dc5de78
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Nov 20, 2024
0ca3f64
Merge branch 'main' into enhance/404-logging-concept
hohwille Nov 28, 2024
26344ad
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Jan 21, 2025
76d3527
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Jan 21, 2025
fc74f71
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Jan 22, 2025
2fb8f0d
#404: implemented requested changes
jan-vcapgemini Jan 22, 2025
3a0616f
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Jan 23, 2025
aaa9fd3
#404: implemented IdeLoggerAdapter
jan-vcapgemini Jan 27, 2025
c7b170a
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Jan 27, 2025
ef08b4e
#404: fixed WireMock tests
jan-vcapgemini Jan 27, 2025
5cd1ab3
#404: fixed WireMock tests
jan-vcapgemini Jan 28, 2025
e8a30a8
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Jan 28, 2025
b4669bb
#404: fixed WireMock tests
jan-vcapgemini Jan 28, 2025
8769dcc
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Jan 29, 2025
98a0f2e
#404: refactored urls into url-updater
jan-vcapgemini Feb 4, 2025
19273ac
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Feb 4, 2025
793417a
#404: fixed github actions workflow
jan-vcapgemini Feb 5, 2025
72f2000
#404: fixed test package names
jan-vcapgemini Feb 5, 2025
e70b96e
#404: fixed assertThat import
jan-vcapgemini Feb 5, 2025
eca4217
#404: removed FQN
jan-vcapgemini Feb 5, 2025
cc145f3
#404: fixed assertThat import
jan-vcapgemini Feb 5, 2025
1beb57d
#404: implemented requested changes
jan-vcapgemini Feb 7, 2025
2597874
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Mar 11, 2025
a8600d6
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Mar 31, 2025
b87d21a
#404: removed outdated imports
jan-vcapgemini Mar 31, 2025
c1c545b
Merge branch 'main' into enhance/404-logging-concept
jan-vcapgemini Mar 31, 2025
e21c0a2
#404: removed jackson-core dependency
jan-vcapgemini Apr 1, 2025
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 .github/workflows/update-urls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cache: 'maven'
- name: Build and run url updater
run: |
cd cli
cd url-updater
mvn -B -ntp -Dstyle.color=always install
mvn -B -ntp -Dstyle.color=always exec:java -Dexec.mainClass="com.devonfw.tools.ide.url.UpdateInitiator" -Dexec.args="../ide-urls PT5H30M"
- name: Commit and push to ide-urls
Expand Down
17 changes: 8 additions & 9 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
<artifactId>parsson</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand All @@ -62,12 +67,6 @@
<version>2.0.12</version>
<!--optional>true</optional-->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.5.3</version>
<!--optional>true</optional-->
</dependency>
<dependency>
<groupId>me.tongfei</groupId>
<artifactId>progressbar</artifactId>
Expand All @@ -93,9 +92,9 @@
</dependency>
<!-- Needed for WireMock test support -->
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>2.35.2</version>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>3.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
5 changes: 5 additions & 0 deletions cli/src/main/java/com/devonfw/tools/ide/cli/Ideasy.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.devonfw.tools.ide.commandlet.ContextCommandlet;
import com.devonfw.tools.ide.context.AbstractIdeContext;
import com.devonfw.tools.ide.context.IdeContext;
Expand All @@ -19,6 +22,8 @@ public final class Ideasy {

private AbstractIdeContext context;

private static final Logger logger = LoggerFactory.getLogger(Ideasy.class);

/**
* The default constructor.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public abstract class AbstractIdeContext implements IdeContext {

private NetworkProxy networkProxy;

/** Context used for logging */
public static IdeContext loggingContext;

/**
* The constructor.
*
Expand Down Expand Up @@ -210,6 +213,7 @@ public AbstractIdeContext(IdeStartContextImpl startContext, Path workingDirector
}

this.defaultToolRepository = new DefaultToolRepository(this);
loggingContext = this;
}

private Path findIdeRoot(Path ideHomePath) {
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we need to re-format the code?

Copy link
Contributor Author

@jan-vcapgemini jan-vcapgemini Feb 7, 2025

Choose a reason for hiding this comment

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

Had to enforce the reformat using CTRL+SHIFT+S.
Adjusted now.

Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public String log(Throwable error, String message, Object... args) {
String actualMessage = message;
if (error != null) {
if (isOmitStacktrace(error)) {
if (message == null) {
if (message == null) {
actualMessage = error.getMessage();
}
error = null;
Expand All @@ -150,9 +150,9 @@ public String log(Throwable error, String message, Object... args) {
}
}
if (actualMessage == null) {
actualMessage = "Internal error: Both message and error is null - nothing to log!";
// fail fast if assertions are enabled, so developers of IDEasy will find the bug immediately but in productive use better log the error and continue
assert false : actualMessage;
actualMessage = "Internal error: Both message and error is null - nothing to log!";
// fail fast if assertions are enabled, so developers of IDEasy will find the bug immediately but in productive use better log the error and continue
assert false : actualMessage;
} else if ((args != null) && (args.length > 0)) {
actualMessage = compose(actualMessage, args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class IdeSubLoggerOut extends AbstractIdeSubLogger {
* @param out the {@link Appendable} to {@link Appendable#append(CharSequence) write} log messages to.
* @param colored - {@code true} for colored output according to {@link IdeLogLevel}, {@code false} otherwise.
* @param minLogLevel the minimum log level (threshold).
* @param listener the {@link IdeLogListener} to listen to.
*/
public IdeSubLoggerOut(IdeLogLevel level, Appendable out, boolean colored, IdeLogLevel minLogLevel, IdeLogListener listener) {

Expand Down
Loading
Loading