Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
basimons authored Dec 5, 2023
2 parents 1277578 + 3908d40 commit 1fd8dba
Show file tree
Hide file tree
Showing 22 changed files with 454 additions and 394 deletions.
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The ideal place for questions or discussions about the HiveMQ Community Edition

=== Quick Start

* Download the latest https://github.com/hivemq/hivemq-community-edition/releases/download/2023.8/hivemq-ce-2023.8.zip[HiveMQ CE binary package].
* Download the latest https://github.com/hivemq/hivemq-community-edition/releases/download/2023.9/hivemq-ce-2023.9.zip[HiveMQ CE binary package].
* Unzip the package.
* Run the run.sh (Linux/OSX) or run.bat (Windows) in the bin folder of the package.

Expand Down Expand Up @@ -140,7 +140,7 @@ If you use Gradle, include the following code in your `build.gradle(.kts)` file.
----
dependencies {
implementation("com.hivemq:hivemq-community-edition-embedded:2023.8")
implementation("com.hivemq:hivemq-community-edition-embedded:2023.9")
}
----

Expand All @@ -156,7 +156,7 @@ If you use Maven, include the following code in your `pom.xml` file.
<dependency>
<groupId>com.hivemq</groupId>
<artifactId>hivemq-community-edition-embedded</artifactId>
<version>2023.8</version>
<version>2023.9</version>
</dependency>
</dependencies>
...
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2023.8
version=2023.9
#
# tools
#
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ equalsVerifier = "3.14.2"
findsecbugs = "1.12.0"
guava = "32.0.1-jre"
guice = "5.1.0"
hivemq-extensionSdk = "4.21.0"
hivemq-extensionSdk = "4.22.0"
jackson = "2.15.2"
javassist = "3.29.2-GA"
javax-annotation-api = "1.3.2"
Expand Down
5 changes: 3 additions & 2 deletions src/distribution/bin/diagnostics.bat
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ rem limitations under the License.
set "JAVA_OPTS=%JAVA_OPTS% --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/sun.security.provider=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED"

rem JMX Monitoring
set "JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false %JAVA_OPTS%"
IF NOT DEFINED HIVEMQ_JMX_PORT SET "HIVEMQ_JMX_PORT=9010"
set "JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=%HIVEMQ_JMX_PORT% -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false %JAVA_OPTS%"

set "JAVA_OPTS=-DdiagnosticMode=true %JAVA_OPTS%"

Expand Down Expand Up @@ -128,4 +129,4 @@ GOTO :EOF

:RESOLVE
SET %2=%~f1
GOTO :EOF
GOTO :EOF
2 changes: 1 addition & 1 deletion src/distribution/bin/diagnostics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if hash java 2>/dev/null; then
fi

# JMX Monitoring
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=${HIVEMQ_JMX_PORT:-9010} -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

JAVA_OPTS="$JAVA_OPTS -DdiagnosticMode=true"

Expand Down
5 changes: 3 additions & 2 deletions src/distribution/bin/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ rem limitations under the License.


rem JMX Monitoring
set "JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false %JAVA_OPTS%"
IF NOT DEFINED HIVEMQ_JMX_PORT SET "HIVEMQ_JMX_PORT=9010"
set "JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=%HIVEMQ_JMX_PORT% -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false %JAVA_OPTS%"

rem Uncomment for enabling diagnostic mode
rem set "JAVA_OPTS=-DdiagnosticMode=true %JAVA_OPTS%"
Expand Down Expand Up @@ -128,4 +129,4 @@ GOTO :EOF

:RESOLVE
SET %2=%~f1
GOTO :EOF
GOTO :EOF
2 changes: 1 addition & 1 deletion src/distribution/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if hash java 2>/dev/null; then
fi

# JMX Monitoring
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=${HIVEMQ_JMX_PORT:-9010} -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

# Uncomment for enabling Diagnostic Mode
#JAVA_OPTS="$JAVA_OPTS -DdiagnosticMode=true"
Expand Down
4 changes: 2 additions & 2 deletions src/distribution/third-party-licenses/licenses
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ HiveMQ uses the following third party libraries:
com.sun.activation:jakarta.activation | 1.2.2 | BSD-3-Clause | https://www.eclipse.org/org/documents/edl-v10.php
com.sun.xml.bind:jaxb-impl | 2.3.8 | BSD-3-Clause | https://www.eclipse.org/org/documents/edl-v10.php
commons-io:commons-io | 2.13.0 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
io.dropwizard.metrics:metrics-core | 4.2.19 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
io.dropwizard.metrics:metrics-core | 4.2.22 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
io.dropwizard.metrics:metrics-jmx | 4.2.19 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
io.dropwizard.metrics:metrics-logback | 4.2.19 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
io.github.microutils:kotlin-logging | 1.4.1 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
Expand Down Expand Up @@ -56,7 +56,7 @@ HiveMQ uses the following third party libraries:
org.jetbrains.xodus:xodus-utils | 1.2.3 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
org.rocksdb:rocksdbjni | 7.4.5 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
org.slf4j:jul-to-slf4j | 2.0.7 | MIT | https://spdx.org/licenses/MIT.html
org.slf4j:slf4j-api | 2.0.7 | MIT | https://spdx.org/licenses/MIT.html
org.slf4j:slf4j-api | 2.0.9 | MIT | https://spdx.org/licenses/MIT.html
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The open source code of the libraries can be obtained by sending an email to [email protected].
4 changes: 2 additions & 2 deletions src/distribution/third-party-licenses/licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ <h2>Third Party Licenses</h2>
</tr>
<tr>
<td>io.dropwizard.metrics:metrics-core</td>
<td>4.2.19</td>
<td>4.2.22</td>
<td>Apache-2.0</td>
<td>
<a href="https://spdx.org/licenses/Apache-2.0.html">https://spdx.org/licenses/Apache-2.0.html</a>
Expand Down Expand Up @@ -487,7 +487,7 @@ <h2>Third Party Licenses</h2>
</tr>
<tr>
<td>org.slf4j:slf4j-api</td>
<td>2.0.7</td>
<td>2.0.9</td>
<td>MIT</td>
<td>
<a href="https://spdx.org/licenses/MIT.html">https://spdx.org/licenses/MIT.html</a>
Expand Down
51 changes: 15 additions & 36 deletions src/main/java/com/hivemq/bootstrap/LoggingBootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
import ch.qos.logback.core.read.ListAppender;
import ch.qos.logback.core.util.StatusPrinter;
import com.hivemq.extension.sdk.api.annotations.NotNull;
import com.hivemq.logging.NettyLogLevelModifier;
import com.hivemq.logging.XodusEnvironmentImplLogLevelModificator;
import com.hivemq.logging.XodusFileDataWriterLogLevelModificator;
import com.hivemq.logging.LogLevelModifierTurboFilter;
import com.hivemq.logging.modifier.NettyLogLevelModifier;
import com.hivemq.logging.modifier.XodusEnvironmentImplLogLevelModifier;
import com.hivemq.logging.modifier.XodusFileDataWriterLogLevelModifier;
import org.apache.commons.lang3.SystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -42,22 +43,15 @@
* This class is responsible for all logging bootstrapping. This is only
* needed at the very beginning of HiveMQs lifecycle and before bootstrapping other
* resources
*
* @author Dominik Obermaier
*/
public class LoggingBootstrap {

private static @NotNull ListAppender<ILoggingEvent> listAppender = new ListAppender<>();

private static final Logger log = LoggerFactory.getLogger(LoggingBootstrap.class);

private static final XodusFileDataWriterLogLevelModificator xodusFileDataWriterLogLevelModificator =
new XodusFileDataWriterLogLevelModificator();
private static final NettyLogLevelModifier nettyLogLevelModifier = new NettyLogLevelModifier();
private static final XodusEnvironmentImplLogLevelModificator xodusEnvironmentImplLogLevelModificator =
new XodusEnvironmentImplLogLevelModificator();

private static @NotNull ListAppender<ILoggingEvent> listAppender = new ListAppender<>();
private static final List<Appender<ILoggingEvent>> defaultAppenders = new LinkedList<>();
private static final @NotNull LogLevelModifierTurboFilter logLevelModifierTurboFilter =
new LogLevelModifierTurboFilter();

/**
* Prepares the logging. This method must be called before any logging occurs
Expand Down Expand Up @@ -90,9 +84,8 @@ public static void prepareLogging() {
public static void initLogging(final @NotNull File configFolder) {

final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
final ch.qos.logback.classic.Logger logger = getRootLogger();

context.addListener(new LogbackChangeListener(logger));
context.addListener(new LogbackChangeListener());

final boolean overridden = overrideLogbackXml(configFolder);

Expand All @@ -104,13 +97,15 @@ public static void initLogging(final @NotNull File configFolder) {

reset();

context.addTurboFilter(logLevelModifierTurboFilter);

// must be added here, as addLoglevelModifiers() is much to late
if (SystemUtils.IS_OS_WINDOWS) {
context.addTurboFilter(xodusFileDataWriterLogLevelModificator);
logLevelModifierTurboFilter.registerLogLevelModifier(new XodusFileDataWriterLogLevelModifier());
log.trace("Added Xodus log level modifier for FileDataWriter.class");
}

context.addTurboFilter(nettyLogLevelModifier);
logLevelModifierTurboFilter.registerLogLevelModifier(new NettyLogLevelModifier());
log.trace("Added Netty log level modifier");
}

Expand Down Expand Up @@ -194,9 +189,7 @@ private static boolean overrideLogbackXml(final @NotNull File configFolder) {
}

public static void addLoglevelModifiers() {
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();

context.addTurboFilter(xodusEnvironmentImplLogLevelModificator);
logLevelModifierTurboFilter.registerLogLevelModifier(new XodusEnvironmentImplLogLevelModifier());
log.trace("Added Xodus log level modifier for EnvironmentImpl.class");
}

Expand All @@ -208,14 +201,7 @@ private static void reset() {
listAppender.list.clear();
}

private static class LogbackChangeListener implements LoggerContextListener {

private final @NotNull ch.qos.logback.classic.Logger logger;

private LogbackChangeListener(
final @NotNull ch.qos.logback.classic.Logger logger) {
this.logger = logger;
}
private static final class LogbackChangeListener implements LoggerContextListener {

@Override
public boolean isResetResistant() {
Expand All @@ -237,7 +223,7 @@ public void onStart(final @NotNull LoggerContext context) {
@Override
public void onReset(final @NotNull LoggerContext context) {
log.trace("logback.xml was changed");
addTurboFilters(context);
context.addTurboFilter(logLevelModifierTurboFilter);
}

@Override
Expand All @@ -249,12 +235,5 @@ public void onStop(final @NotNull LoggerContext context) {
public void onLevelChange(final @NotNull ch.qos.logback.classic.Logger logger, final @NotNull Level level) {
//noop
}

private void addTurboFilters(final @NotNull LoggerContext context) {

context.addTurboFilter(xodusFileDataWriterLogLevelModificator);
context.addTurboFilter(nettyLogLevelModifier);
context.addTurboFilter(xodusEnvironmentImplLogLevelModificator);
}
}
}
62 changes: 62 additions & 0 deletions src/main/java/com/hivemq/logging/LogLevelModifierTurboFilter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2019-present HiveMQ GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hivemq.logging;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.turbo.TurboFilter;
import ch.qos.logback.core.spi.FilterReply;
import com.hivemq.extension.sdk.api.annotations.NotNull;
import com.hivemq.extension.sdk.api.annotations.Nullable;
import com.hivemq.logging.modifier.LogLevelModifier;
import org.slf4j.Marker;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class LogLevelModifierTurboFilter extends TurboFilter {

private final @NotNull List<LogLevelModifier> logLevelModifiers = new CopyOnWriteArrayList<>();

@Override
public @NotNull FilterReply decide(
final @Nullable Marker marker,
final @NotNull Logger logger,
final @NotNull Level level,
final @Nullable String format,
final @Nullable Object @Nullable [] params,
final @Nullable Throwable t) {

FilterReply filterReply = FilterReply.NEUTRAL;

if (format == null || level == Level.OFF) {
// format is the log message
return filterReply;
}

for (final LogLevelModifier logLevelModifier : logLevelModifiers) {
filterReply = logLevelModifier.decide(marker, logger, level, format, params, t);
if (filterReply != FilterReply.NEUTRAL) {
return filterReply;
}
}
return filterReply;
}

public void registerLogLevelModifier(final @NotNull LogLevelModifier logLevelModifier) {
logLevelModifiers.add(logLevelModifier);
}
}
Loading

0 comments on commit 1fd8dba

Please sign in to comment.