Skip to content

Commit 2ba212f

Browse files
authored
Merge pull request #74 from evolvedbinary/6.x.x/feature/cleanup-startup-messages
[6.x.x] Cleanup startup messages
2 parents 06023f1 + c69f466 commit 2ba212f

File tree

29 files changed

+166
-194
lines changed

29 files changed

+166
-194
lines changed

exist-ant/src/test/resources/log4j2.xml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,7 @@
165165
<AppenderRef ref="elemental.core"/>
166166
</Logger>
167167

168-
<Logger name="org.exist.jetty.JettyStart" additivity="false" level="trace">
169-
<AppenderRef ref="STDOUT"/>
170-
<AppenderRef ref="elemental.core"/>
171-
</Logger>
172-
173-
<Logger name="org.exist.jetty.StandaloneServer" additivity="false" level="trace">
168+
<Logger name="org.exist.jetty.JettyStart" additivity="false" level="warn">
174169
<AppenderRef ref="STDOUT"/>
175170
<AppenderRef ref="elemental.core"/>
176171
</Logger>
@@ -179,12 +174,12 @@
179174
<AppenderRef ref="elemental.profiling"/>
180175
</Logger>
181176

182-
<Logger name="org.exist.statistics" additivity="false" level="debug">
177+
<Logger name="org.exist.statistics" additivity="false" level="info">
183178
<AppenderRef ref="elemental.core"/>
184179
<AppenderRef ref="elemental.statistics"/>
185180
</Logger>
186181

187-
<Logger name="org.exist.backup.SystemExport" additivity="false" level="trace">
182+
<Logger name="org.exist.backup.SystemExport" additivity="false" level="info">
188183
<AppenderRef ref="elemental.backup"/>
189184
</Logger>
190185

exist-core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,8 @@
826826
<include>src/main/java/org/exist/http/Descriptor.java</include>
827827
<include>src/main/java/org/exist/http/RESTServer.java</include>
828828
<include>src/test/java/org/exist/http/RESTServiceTest.java</include>
829+
<include>src/main/java/org/exist/http/servlets/AbstractExistHttpServlet.java</include>
830+
<include>src/main/java/org/exist/http/servlets/XQueryServlet.java</include>
829831
<include>src/main/java/org/exist/http/servlets/XSLTServlet.java</include>
830832
<include>src/main/java/org/exist/http/urlrewrite/ModuleCall.java</include>
831833
<include>src/main/java/org/exist/http/urlrewrite/PathForward.java</include>
@@ -1162,6 +1164,8 @@
11621164
<exclude>src/main/java/org/exist/http/Descriptor.java</exclude>
11631165
<exclude>src/main/java/org/exist/http/RESTServer.java</exclude>
11641166
<exclude>src/test/java/org/exist/http/RESTServiceTest.java</exclude>
1167+
<exclude>src/main/java/org/exist/http/servlets/AbstractExistHttpServlet.java</exclude>
1168+
<exclude>src/main/java/org/exist/http/servlets/XQueryServlet.java</exclude>
11651169
<exclude>src/main/java/org/exist/http/servlets/XSLTServlet.java</exclude>
11661170
<exclude>src/main/java/org/exist/http/urlrewrite/ModuleCall.java</exclude>
11671171
<exclude>src/main/java/org/exist/http/urlrewrite/PathForward.java</exclude>

exist-core/src/main/java/org/exist/http/servlets/AbstractExistHttpServlet.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -98,7 +122,9 @@ private BrokerPool getOrCreateBrokerPool(final ServletConfig config) throws EXis
98122

99123
// Configure BrokerPool
100124
if(BrokerPool.isConfigured()) {
101-
getLog().info("Database already started. Skipping configuration ...");
125+
if (getLog().isDebugEnabled()) {
126+
getLog().debug("Database already started. Skipping configuration ...");
127+
}
102128
} else {
103129
final String confFile = Optional.ofNullable(config.getInitParameter("configuration")).orElse("conf.xml");
104130

@@ -186,9 +212,11 @@ private void doGeneralExistServletConfig(ServletConfig config) {
186212
}
187213

188214
if (getDefaultUser() != null) {
189-
getLog().info("Using default user {} for all unauthorized requests.", getDefaultUsername());
215+
if (getLog().isDebugEnabled()) {
216+
getLog().debug("Using default user '{}' for all unauthorized requests.", getDefaultUsername());
217+
}
190218
} else {
191-
getLog().error("Default user {} cannot be found. A BASIC AUTH challenge will be the default.", getDefaultUsername());
219+
getLog().warn("Default user '{}' cannot be found. A BASIC AUTH challenge will be the default.", getDefaultUsername());
192220
}
193221
} else {
194222
getLog().info("No default user. All requires must be authorized or will result in a BASIC AUTH challenge.");

exist-core/src/main/java/org/exist/http/servlets/XQueryServlet.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -144,7 +168,9 @@ public void init(ServletConfig config) throws ServletException {
144168
if(encoding == null) {
145169
encoding = DEFAULT_ENCODING;
146170
}
147-
getLog().info("encoding = {}", encoding);
171+
if (getLog().isDebugEnabled()) {
172+
getLog().debug("encoding = {}", encoding);
173+
}
148174

149175
contentType = config.getInitParameter("content-type");
150176
if(contentType == null) {

exist-core/src/main/java/org/exist/jetty/JettyStart.java

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ public synchronized void run(final String[] args, final Observer observer) {
202202
addObserver(observer);
203203
}
204204

205-
logger.info("Running with Java {} [{} ({}) in {}]",
205+
logger.info("Operating System: {} {} {}]", System.getProperty("os.name"), System.getProperty("os.version"), System.getProperty("os.arch"));
206+
logger.info("Running as user: {}", System.getProperty("user.name", "(unknown user.name)"));
207+
logger.info("Using Java: {} [{} ({}) in {}]",
206208
System.getProperty("java.version", "(unknown java.version)"),
207209
System.getProperty("java.vendor", "(unknown java.vendor)"),
208210
System.getProperty("java.vm.name", "(unknown java.vm.name)"),
@@ -212,19 +214,11 @@ public synchronized void run(final String[] args, final Observer observer) {
212214
logger.info("Approximate maximum amount of memory for JVM: {}", FileUtils.humanSize(Runtime.getRuntime().maxMemory()));
213215
logger.info("Number of processors available to JVM: {}", Runtime.getRuntime().availableProcessors());
214216

215-
logger.info("Running as user '{}'", System.getProperty("user.name", "(unknown user.name)"));
216-
logger.info("[Elemental Home : {}]", System.getProperty("exist.home", "unknown"));
217-
logger.info("[Elemental Version : {}]", SystemProperties.getInstance().getSystemProperty("product-version", "unknown"));
218-
logger.info("[Elemental Build : {}]", SystemProperties.getInstance().getSystemProperty("product-build", "unknown"));
219-
logger.info("[Git commit : {}]", SystemProperties.getInstance().getSystemProperty("git-commit", "unknown"));
220-
logger.info("[Git commit timestamp : {}]", SystemProperties.getInstance().getSystemProperty("git-commit-timestamp", "unknown"));
221-
222-
logger.info("[Operating System : {} {} {}]", System.getProperty("os.name"), System.getProperty("os.version"), System.getProperty("os.arch"));
223-
logger.info("[log4j.configurationFile : {}]", System.getProperty("log4j.configurationFile"));
224-
logger.info("[jetty Version: {}]", Jetty.VERSION);
225-
logger.info("[{} : {}]", JETTY_HOME_PROP, configProperties.get(JETTY_HOME_PROP));
226-
logger.info("[{} : {}]", JETTY_BASE_PROP, configProperties.get(JETTY_BASE_PROP));
227-
logger.info("[jetty configuration : {}]", jettyConfig.toAbsolutePath().toString());
217+
logger.info("[Elemental Version: {}]", SystemProperties.getInstance().getSystemProperty("product-version", "unknown"));
218+
logger.info("[Elemental Build: {}]", SystemProperties.getInstance().getSystemProperty("product-build", "unknown"));
219+
logger.info("[Elemental Git commit: {}]", SystemProperties.getInstance().getSystemProperty("git-commit", "unknown"));
220+
logger.info("[Elemental Git commit timestamp: {}]", SystemProperties.getInstance().getSystemProperty("git-commit-timestamp", "unknown"));
221+
logger.info("[Elemental Home: {}]", System.getProperty("exist.home", "unknown"));
228222

229223
// configure the database instance
230224
SingleInstanceConfiguration config;
@@ -233,10 +227,16 @@ public synchronized void run(final String[] args, final Observer observer) {
233227
} else {
234228
config = new SingleInstanceConfiguration();
235229
}
236-
logger.info("Configuring Elemental from {}",
237-
config.getConfigFilePath()
238-
.map(Path::normalize).map(Path::toAbsolutePath).map(Path::toString)
239-
.orElse("<UNKNOWN>"));
230+
final String elementalConfigPath = config.getConfigFilePath()
231+
.map(Path::normalize).map(Path::toAbsolutePath).map(Path::toString)
232+
.orElse("<UNKNOWN>");
233+
logger.info("[Elemental Configuration: {}]", elementalConfigPath);
234+
235+
logger.info("[Log4j Configuration: {}]", System.getProperty("log4j.configurationFile"));
236+
logger.info("[Jetty Version: {}]", Jetty.VERSION);
237+
logger.info("[Jetty Home: {}]", configProperties.get(JETTY_HOME_PROP));
238+
logger.info("[Jetty Base: {}]", configProperties.get(JETTY_BASE_PROP));
239+
logger.info("[Jetty Configuration: {}]", jettyConfig.toAbsolutePath().toString());
240240

241241
BrokerPool.configure(1, 5, config, Optional.ofNullable(observer));
242242

@@ -257,7 +257,9 @@ public synchronized void run(final String[] args, final Observer observer) {
257257
final List<Object> configuredObjects = new ArrayList<>();
258258
XmlConfiguration last = null;
259259
for(final Path confFile : configFiles) {
260-
logger.info("[loading jetty configuration : {}]", confFile.toString());
260+
if (logger.isDebugEnabled()) {
261+
logger.debug("[Loading Jetty Configuration: {}]", confFile.toString());
262+
}
261263
try(final InputStream is = Files.newInputStream(confFile)) {
262264
final XmlConfiguration configuration = new XmlConfiguration(is);
263265
if (last != null) {
@@ -486,7 +488,9 @@ private Optional<Server> startJetty(final List<Object> configuredObjects) throws
486488

487489
try {
488490
Runtime.getRuntime().addShutdownHook(shutdownHookThread);
489-
logger.debug("BrokerPoolsAndJetty.ShutdownHook hook registered");
491+
if (logger.isDebugEnabled()) {
492+
logger.debug("BrokerPoolsAndJetty.ShutdownHook hook registered");
493+
}
490494
} catch (final IllegalArgumentException | IllegalStateException e) {
491495
// Hook already registered, or Shutdown in progress
492496
logger.error("Unable to add BrokerPoolsAndJetty.ShutdownHook hook: {}", e.getMessage(), e);
@@ -499,7 +503,9 @@ private Optional<Server> startJetty(final List<Object> configuredObjects) throws
499503
if (configuredObject instanceof LifeCycle) {
500504
final LifeCycle lc = (LifeCycle)configuredObject;
501505
if (!lc.isRunning()) {
502-
logger.info("[Starting jetty component : {}]", lc.getClass().getName());
506+
if (logger.isDebugEnabled()) {
507+
logger.debug("[Starting Jetty Component : {}]", lc.getClass().getName());
508+
}
503509
lc.start();
504510
}
505511
}
@@ -561,7 +567,9 @@ public synchronized void shutdown() {
561567
shutdownHookThread.ifPresent(thread -> {
562568
try {
563569
Runtime.getRuntime().removeShutdownHook(thread);
564-
logger.debug("BrokerPoolsAndJetty.ShutdownHook hook unregistered");
570+
if (logger.isDebugEnabled()) {
571+
logger.debug("BrokerPoolsAndJetty.ShutdownHook hook unregistered");
572+
}
565573
} catch (final IllegalStateException e) {
566574
// Shutdown in progress
567575
logger.warn("Unable to remove BrokerPoolsAndJetty.ShutdownHook hook: {}", e.getMessage());
@@ -656,7 +664,9 @@ public synchronized boolean isStarted() {
656664

657665
@Override
658666
public synchronized void lifeCycleStarting(final LifeCycle lifeCycle) {
659-
logger.info("Jetty server starting...");
667+
if (logger.isDebugEnabled()) {
668+
logger.debug("Jetty server starting...");
669+
}
660670
setChanged();
661671
notifyObservers(SIGNAL_STARTING);
662672
status = STATUS_STARTING;
@@ -665,7 +675,9 @@ public synchronized void lifeCycleStarting(final LifeCycle lifeCycle) {
665675

666676
@Override
667677
public synchronized void lifeCycleStarted(final LifeCycle lifeCycle) {
668-
logger.info("Jetty server started.");
678+
if (logger.isDebugEnabled()) {
679+
logger.debug("Jetty server started.");
680+
}
669681
setChanged();
670682
notifyObservers(SIGNAL_STARTED);
671683
status = STATUS_STARTED;
@@ -678,14 +690,18 @@ public void lifeCycleFailure(final LifeCycle lifeCycle, final Throwable throwabl
678690

679691
@Override
680692
public synchronized void lifeCycleStopping(final LifeCycle lifeCycle) {
681-
logger.info("Jetty server stopping...");
693+
if (logger.isDebugEnabled()) {
694+
logger.debug("Jetty server stopping...");
695+
}
682696
status = STATUS_STOPPING;
683697
notifyAll();
684698
}
685699

686700
@Override
687701
public synchronized void lifeCycleStopped(final LifeCycle lifeCycle) {
688-
logger.info("Jetty server stopped");
702+
if (logger.isDebugEnabled()) {
703+
logger.debug("Jetty server stopped");
704+
}
689705
status = STATUS_STOPPED;
690706
notifyAll();
691707
}

exist-core/src/test/resources/log4j2.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,16 @@
165165
<AppenderRef ref="elemental.core"/>
166166
</Logger>
167167

168-
<Logger name="org.exist.jetty.StandaloneServer" additivity="false" level="warn">
169-
<AppenderRef ref="elemental.core"/>
170-
</Logger>
171-
172168
<Logger name="xquery.profiling" additivity="false" level="trace">
173169
<AppenderRef ref="elemental.profiling"/>
174170
</Logger>
175171

176-
<Logger name="org.exist.statistics" additivity="false" level="debug">
172+
<Logger name="org.exist.statistics" additivity="false" level="info">
177173
<AppenderRef ref="elemental.core"/>
178174
<AppenderRef ref="elemental.statistics"/>
179175
</Logger>
180176

181-
<Logger name="org.exist.backup.SystemExport" additivity="false" level="trace">
177+
<Logger name="org.exist.backup.SystemExport" additivity="false" level="info">
182178
<AppenderRef ref="elemental.backup"/>
183179
</Logger>
184180

exist-distribution/src/main/config/log4j2.xml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,7 @@
142142
<AppenderRef ref="elemental.core"/>
143143
</Logger>
144144

145-
<Logger name="org.exist.jetty.JettyStart" additivity="false" level="trace">
146-
<AppenderRef ref="STDOUT"/>
147-
<AppenderRef ref="elemental.core"/>
148-
</Logger>
149-
150-
<Logger name="org.exist.jetty.StandaloneServer" additivity="false" level="trace">
145+
<Logger name="org.exist.jetty.JettyStart" additivity="false" level="info">
151146
<AppenderRef ref="STDOUT"/>
152147
<AppenderRef ref="elemental.core"/>
153148
</Logger>
@@ -156,12 +151,12 @@
156151
<AppenderRef ref="elemental.profiling"/>
157152
</Logger>
158153

159-
<Logger name="org.exist.statistics" additivity="false" level="debug">
154+
<Logger name="org.exist.statistics" additivity="false" level="info">
160155
<AppenderRef ref="elemental.core"/>
161156
<AppenderRef ref="elemental.statistics"/>
162157
</Logger>
163158

164-
<Logger name="org.exist.backup.SystemExport" additivity="false" level="trace">
159+
<Logger name="org.exist.backup.SystemExport" additivity="false" level="info">
165160
<AppenderRef ref="elemental.backup"/>
166161
</Logger>
167162

extensions/contentextraction/src/test/resources/log4j2.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,16 @@
165165
<AppenderRef ref="elemental.core"/>
166166
</Logger>
167167

168-
<Logger name="org.exist.jetty.StandaloneServer" additivity="false" level="warn">
169-
<AppenderRef ref="elemental.core"/>
170-
</Logger>
171-
172168
<Logger name="xquery.profiling" additivity="false" level="trace">
173169
<AppenderRef ref="elemental.profiling"/>
174170
</Logger>
175171

176-
<Logger name="org.exist.statistics" additivity="false" level="debug">
172+
<Logger name="org.exist.statistics" additivity="false" level="info">
177173
<AppenderRef ref="elemental.core"/>
178174
<AppenderRef ref="elemental.statistics"/>
179175
</Logger>
180176

181-
<Logger name="org.exist.backup.SystemExport" additivity="false" level="trace">
177+
<Logger name="org.exist.backup.SystemExport" additivity="false" level="info">
182178
<AppenderRef ref="elemental.backup"/>
183179
</Logger>
184180

extensions/debuggee/src/test/resources/log4j2.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,16 @@
165165
<AppenderRef ref="elemental.core"/>
166166
</Logger>
167167

168-
<Logger name="org.exist.jetty.StandaloneServer" additivity="false" level="warn">
169-
<AppenderRef ref="elemental.core"/>
170-
</Logger>
171-
172168
<Logger name="xquery.profiling" additivity="false" level="trace">
173169
<AppenderRef ref="elemental.profiling"/>
174170
</Logger>
175171

176-
<Logger name="org.exist.statistics" additivity="false" level="debug">
172+
<Logger name="org.exist.statistics" additivity="false" level="info">
177173
<AppenderRef ref="elemental.core"/>
178174
<AppenderRef ref="elemental.statistics"/>
179175
</Logger>
180176

181-
<Logger name="org.exist.backup.SystemExport" additivity="false" level="trace">
177+
<Logger name="org.exist.backup.SystemExport" additivity="false" level="info">
182178
<AppenderRef ref="elemental.backup"/>
183179
</Logger>
184180

0 commit comments

Comments
 (0)