diff --git a/community/server/src/main/java/org/neo4j/server/AbstractNeoServer.java b/community/server/src/main/java/org/neo4j/server/AbstractNeoServer.java index 5f0252113babb..1dff919752bde 100644 --- a/community/server/src/main/java/org/neo4j/server/AbstractNeoServer.java +++ b/community/server/src/main/java/org/neo4j/server/AbstractNeoServer.java @@ -50,6 +50,7 @@ import org.neo4j.kernel.impl.util.Dependencies; import org.neo4j.kernel.impl.util.JobScheduler; import org.neo4j.kernel.info.DiagnosticsManager; +import org.neo4j.kernel.internal.Version; import org.neo4j.kernel.lifecycle.LifeSupport; import org.neo4j.logging.Log; import org.neo4j.logging.LogProvider; @@ -109,6 +110,7 @@ public abstract class AbstractNeoServer implements NeoServer Pattern.compile( "/browser.*" ), Pattern.compile( "/" ) }; + public static final String NEO4J_IS_STARTING_MESSAGE = "======== Neo4j " + Version.getNeo4jVersion() + " ========"; private final Database.Factory dbFactory; private final GraphDatabaseFacadeFactory.Dependencies dependencies; @@ -145,6 +147,7 @@ public AbstractNeoServer( Config config, Database.Factory dbFactory, this.dependencies = dependencies; this.logProvider = logProvider; this.log = logProvider.getLog( getClass() ); + log.info( NEO4J_IS_STARTING_MESSAGE ); httpAddress = httpConnector( config, HttpConnector.Encryption.NONE ) .orElseThrow( () -> diff --git a/community/server/src/test/java/org/neo4j/server/NeoServerStartupLoggingIT.java b/community/server/src/test/java/org/neo4j/server/NeoServerStartupLoggingIT.java index 7f2e307780830..3d22a37cda42b 100644 --- a/community/server/src/test/java/org/neo4j/server/NeoServerStartupLoggingIT.java +++ b/community/server/src/test/java/org/neo4j/server/NeoServerStartupLoggingIT.java @@ -19,24 +19,26 @@ */ package org.neo4j.server; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - import com.sun.jersey.api.client.Client; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + import org.neo4j.logging.FormattedLogProvider; import org.neo4j.server.helpers.ServerHelper; import org.neo4j.server.rest.JaxRsResponse; import org.neo4j.server.rest.RestRequest; import org.neo4j.test.server.ExclusiveServerTestBase; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; +import static org.neo4j.server.AbstractNeoServer.NEO4J_IS_STARTING_MESSAGE; public class NeoServerStartupLoggingIT extends ExclusiveServerTestBase { @@ -66,8 +68,9 @@ public static void stopServer() public void shouldLogStartup() throws Exception { // Check the logs - assertThat( out.toString().length(), is( greaterThan( 0 ) ) ); - + String logContent = out.toString(); + assertThat( logContent.length(), is( greaterThan( 0 ) ) ); + assertThat( logContent, containsString( NEO4J_IS_STARTING_MESSAGE ) ); // Check the server is alive Client nonRedirectingClient = Client.create(); nonRedirectingClient.setFollowRedirects( false ); diff --git a/community/server/src/test/java/org/neo4j/server/integration/StartupLoggingIT.java b/community/server/src/test/java/org/neo4j/server/integration/StartupLoggingIT.java index ba568d73b37db..eda6118a233f5 100644 --- a/community/server/src/test/java/org/neo4j/server/integration/StartupLoggingIT.java +++ b/community/server/src/test/java/org/neo4j/server/integration/StartupLoggingIT.java @@ -48,6 +48,7 @@ import static org.hamcrest.MatcherAssert.assertThat; +import static org.neo4j.server.AbstractNeoServer.NEO4J_IS_STARTING_MESSAGE; import static org.neo4j.server.configuration.ServerSettings.httpConnector; public class StartupLoggingIT extends ExclusiveServerTestBase @@ -76,6 +77,7 @@ public void shouldLogHelpfulStartupMessages() throws Throwable List captured = suppressOutput.getOutputVoice().lines(); assertThat( captured, containsAtLeastTheseLines( warn( "Config file \\[nonexistent-file.conf\\] does not exist." ), + info( NEO4J_IS_STARTING_MESSAGE ), info( "Starting..." ), info( "Started." ), info( "Remote interface available at http://.+:7474/" ),