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
5 changes: 5 additions & 0 deletions ${env:LOG_PATH}/elk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{"instant":{"epochSecond":1759267686,"nanoOfSecond":287657475},"thread":"Test worker","level":"INFO","loggerName":"org.springframework.test.context.support.AnnotationConfigContextLoaderUtils","message":"Could not detect default configuration classes for test class [com.example.elk_example.ElkExampleApplicationTests]: ElkExampleApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.","contextMap":{},"endOfBatch":true,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","threadId":1,"threadPriority":5}
{"instant":{"epochSecond":1759267686,"nanoOfSecond":396775893},"thread":"Test worker","level":"INFO","loggerName":"org.springframework.boot.test.context.SpringBootTestContextBootstrapper","message":"Found @SpringBootConfiguration com.example.elk_example.ElkExampleApplication for test class com.example.elk_example.ElkExampleApplicationTests","contextMap":{},"endOfBatch":true,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","threadId":1,"threadPriority":5}
{"instant":{"epochSecond":1759267686,"nanoOfSecond":774248974},"thread":"Test worker","level":"INFO","loggerName":"com.example.elk_example.ElkExampleApplicationTests","message":"Starting ElkExampleApplicationTests using Java 21.0.8 with PID 7219 (started by runner in /home/runner/work/ELK-Logger/ELK-Logger)","contextMap":{},"endOfBatch":true,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","threadId":1,"threadPriority":5}
{"instant":{"epochSecond":1759267686,"nanoOfSecond":780247480},"thread":"Test worker","level":"INFO","loggerName":"com.example.elk_example.ElkExampleApplicationTests","message":"No active profile set, falling back to 1 default profile: \"default\"","contextMap":{},"endOfBatch":true,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","threadId":1,"threadPriority":5}
{"instant":{"epochSecond":1759267687,"nanoOfSecond":717134907},"thread":"Test worker","level":"INFO","loggerName":"com.example.elk_example.ElkExampleApplicationTests","message":"Started ElkExampleApplicationTests in 1.191 seconds (process running for 2.483)","contextMap":{},"endOfBatch":true,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","threadId":1,"threadPriority":5}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ gradle-app.setting
# JDT-specific (Eclipse Java Development Tools)
.classpath

# End of https://www.toptal.com/developers/gitignore/api/java,gradle,intellij+all
# End of https://www.toptal.com/developers/gitignore/api/java,gradle,intellij+all${env:LOG_PATH}/
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM gradle:7-jdk-alpine AS build
FROM eclipse-temurin:21-jdk AS build
LABEL maintainer="Thomas Mildner"
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN gradle build --no-daemon
COPY --chown=1000:1000 . /home/app/src
WORKDIR /home/app/src
RUN chmod +x gradlew && ./gradlew build --no-daemon

FROM openjdk:17-alpine
FROM eclipse-temurin:21-jre
EXPOSE 8080
RUN mkdir /app
COPY --from=build /home/gradle/src/build/libs/ELK_Example-0.0.1-SNAPSHOT.jar /app/elk-spring-boot-application.jar
COPY --from=build /home/app/src/build/libs/ELK_Example-0.0.1-SNAPSHOT.jar /app/elk-spring-boot-application.jar
ENTRYPOINT ["java", "-jar","/app/elk-spring-boot-application.jar"]
76 changes: 76 additions & 0 deletions UPGRADE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Upgrade Notes - Gradle and Java Version Update

## Summary of Changes

This project has been upgraded to use the latest stable versions of Gradle and Java.

### Version Updates

| Component | Previous Version | New Version |
|-----------|-----------------|-------------|
| Java | 17 | 21 (LTS) |
| Gradle | 7.4 | 8.12 |
| Spring Boot | 2.6.4 | 3.4.1 |
| Spring Dependency Management | 1.0.11.RELEASE | 1.1.7 |
| Docker Base Image (Build) | gradle:7-jdk-alpine | eclipse-temurin:21-jdk |
| Docker Base Image (Runtime) | openjdk:17-alpine | eclipse-temurin:21-jre |

### Changes Made

1. **Gradle Wrapper Update**
- Updated `gradle/wrapper/gradle-wrapper.properties` to use Gradle 8.12
- Gradle wrapper binary updated automatically

2. **Build Configuration**
- Updated `build.gradle`:
- Spring Boot plugin: 2.6.4 → 3.4.1
- Dependency Management plugin: 1.0.11.RELEASE → 1.1.7
- Source compatibility: Java 17 → Java 21

3. **Dockerfile Updates**
- Build stage now uses `eclipse-temurin:21-jdk`
- Runtime stage now uses `eclipse-temurin:21-jre`
- Uses Eclipse Temurin (Adoptium) instead of deprecated OpenJDK images

### Compatibility

- All existing tests pass successfully with Java 21
- Spring Boot 3.4.1 is fully compatible with Java 21
- The application builds and runs without any code changes

### Building the Project

```bash
# Build with Gradle wrapper
./gradlew build

# Run tests
./gradlew test

# Build Docker image
docker build -t elk-logger:latest .

# Or use docker-compose
docker-compose up -d
```

### Notes

- Java 21 is a Long-Term Support (LTS) release, ensuring long-term stability and support
- Gradle 8.12 includes performance improvements and new features
- Spring Boot 3.4.1 includes the latest security patches and features
- The Eclipse Temurin images are the recommended OpenJDK distribution

### Migration Path

If you're upgrading from the previous version:

1. Ensure you have Java 21 installed locally for development
2. Update your IDE to use Java 21
3. Pull the latest changes and run `./gradlew clean build`
4. All dependencies will be downloaded automatically by Gradle
5. No code changes are required

### Known Issues

- Some IDEs may show warnings about Mockito dynamic agent loading in tests with Java 21. This is expected and does not affect functionality.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
plugins {
id 'org.springframework.boot' version '2.6.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.springframework.boot' version '3.4.1'
id 'io.spring.dependency-management' version '1.1.7'
id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
sourceCompatibility = '21'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file modified gradlew
100644 → 100755
Empty file.
178 changes: 89 additions & 89 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega