diff --git a/build.gradle b/build.gradle index bb720a046..e007da3d7 100644 --- a/build.gradle +++ b/build.gradle @@ -199,8 +199,6 @@ dependencies { implementation 'javax.servlet:servlet-api:2.5' // joda-time is required for kbase-common and syslog4j implementation 'joda-time:joda-time:2.2' - // needed for syslog4j - implementation 'net.java.dev.jna:jna:3.4.0' // this is OOOOOOLD. But that probably means updating java_common implementation 'org.eclipse.jetty.aggregate:jetty-all:7.0.0.v20091005' diff --git a/docsource/conf.py b/docsource/conf.py index 62b8d1086..d7f6497c9 100644 --- a/docsource/conf.py +++ b/docsource/conf.py @@ -50,9 +50,9 @@ # built documents. # # The short X.Y version. -version = '0.14' +version = '0.15' # The full version, including alpha/beta/rc tags. -release = '0.14.3' +release = '0.15.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docsource/releasenotes.rst b/docsource/releasenotes.rst index 9e1afb90f..4f5c34341 100644 --- a/docsource/releasenotes.rst +++ b/docsource/releasenotes.rst @@ -3,9 +3,13 @@ Workspace service release notes =============================== -VERSION: 0.14.3 (Released 2/22/2024) +VERSION: 0.15.0 (Released TBD) ------------------------------------ +BACKWARDS INCOMPATIBILIES: + +* The Docserver now logs to standard out in the same way as the workspace server. + UPDATES: * The MongoDB clients have been updated to the most recent version and the service tested diff --git a/src/us/kbase/workspace/docserver/DocServer.java b/src/us/kbase/workspace/docserver/DocServer.java index 0570c0081..ae8bed97c 100644 --- a/src/us/kbase/workspace/docserver/DocServer.java +++ b/src/us/kbase/workspace/docserver/DocServer.java @@ -15,6 +15,7 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.productivity.java.syslog4j.SyslogIF; import com.google.common.io.Files; @@ -34,10 +35,11 @@ public class DocServer extends HttpServlet { /** * The name of the service that this document server is serving documents * for. This name will be used to find the appropriate section of the - * KBase deploy.cfg configuration file if the name is not specified in the - * environment. + * KBase deploy.cfg configuration file. */ - public static final String DEFAULT_COMPANION_SERVICE_NAME = "Workspace"; + public static final String COMPANION_SERVICE_NAME = "Workspace"; + // TODO CONFIG configure directly vs going through JsonSererServlet + /** * The name of this document server, used for logging purposes. */ @@ -56,10 +58,8 @@ public class DocServer extends HttpServlet { private static final FileNameMap FILE_NAME_MAP = URLConnection.getFileNameMap(); - private static final String DONT_TRUST_X_IP_HEADERS = - "dont_trust_x_ip_headers"; - private static final String DONT_TRUST_X_IP_HEADERS2 = - "dont-trust-x-ip-headers"; + private static final String DONT_TRUST_X_IP_HEADERS = "dont_trust_x_ip_headers"; + private static final String DONT_TRUST_X_IP_HEADERS2 = "dont-trust-x-ip-headers"; private static final String STRING_TRUE = "true"; private final String docsLoc; @@ -83,18 +83,13 @@ public class DocServer extends HttpServlet { public DocServer() { //TODO JERSEY switch to a jersey endpoint when that's available, ditch logger, etc. Pretty big rewrite/simplification super(); - /* really should try and get the companion service name from the env - * here, but not worth the effort - */ - JsonServerSyslog templogger = new JsonServerSyslog( - DEFAULT_COMPANION_SERVICE_NAME, JsonServerServlet.KB_DEP, - JsonServerSyslog.LOG_LEVEL_INFO, false); - if (sysLogOut != null) { - templogger.changeOutput(sysLogOut); - } - // getConfig() gets the service name from the env if it exists + JsonServerSyslog.setStaticUseSyslog(false); + final JsonServerSyslog templogger = getLogger(COMPANION_SERVICE_NAME, sysLogOut); + + // getConfig() gets the service name from the env if it exists which is bad + // since the Workspace doesn't. Need to redo configuration handling at some point final Map config = JsonServerServlet.getConfig( - DEFAULT_COMPANION_SERVICE_NAME, templogger); + COMPANION_SERVICE_NAME, templogger); String serverName = config.get(CFG_SERVICE_NAME); if (serverName == null || serverName.isEmpty()) { @@ -110,16 +105,34 @@ public DocServer() { docsLoc = dlog; } } - logger = new JsonServerSyslog(serverName, JsonServerServlet.KB_DEP, - JsonServerSyslog.LOG_LEVEL_INFO, false); - if (sysLogOut != null) { - logger.changeOutput(sysLogOut); - } + logger = getLogger(serverName, sysLogOut); this.trustX_IPHeaders = !STRING_TRUE.equals(config.get(DONT_TRUST_X_IP_HEADERS)) && !STRING_TRUE.equals(config.get(DONT_TRUST_X_IP_HEADERS2)); } + private JsonServerSyslog getLogger( + final String serverName, + final SyslogOutput output) { + final JsonServerSyslog logger = new JsonServerSyslog( + serverName, JsonServerServlet.KB_DEP, JsonServerSyslog.LOG_LEVEL_INFO, false); + if (output == null) { + logger.changeOutput(new SyslogOutput() { + // this is manually tested + @Override + public void logToSystem( + final SyslogIF log, + final int level, + final String message) { + System.out.println(message); + } + }); + } else { + logger.changeOutput(output); + } + return logger; + } + @Override protected void doOptions( final HttpServletRequest request, diff --git a/src/us/kbase/workspace/test/kbase/JSONRPCLayerTest.java b/src/us/kbase/workspace/test/kbase/JSONRPCLayerTest.java index a47c90fcd..da0e3f918 100644 --- a/src/us/kbase/workspace/test/kbase/JSONRPCLayerTest.java +++ b/src/us/kbase/workspace/test/kbase/JSONRPCLayerTest.java @@ -101,7 +101,7 @@ */ public class JSONRPCLayerTest extends JSONRPCLayerTester { - private static final String VER = "0.14.3"; + private static final String VER = "0.15.0"; @Test public void ver() throws Exception { diff --git a/src/us/kbase/workspace/test/kbase/SchemaUpdaterCLITest.java b/src/us/kbase/workspace/test/kbase/SchemaUpdaterCLITest.java index e84f67df5..8e633b75e 100644 --- a/src/us/kbase/workspace/test/kbase/SchemaUpdaterCLITest.java +++ b/src/us/kbase/workspace/test/kbase/SchemaUpdaterCLITest.java @@ -41,7 +41,7 @@ public class SchemaUpdaterCLITest { - private static final String VERSION = "0.14.3"; + private static final String VERSION = "0.15.0"; private static final List HELP = list( "Usage: update_workspace_database_schema [-chosV] ", diff --git a/src/us/kbase/workspace/version/WorkspaceVersion.java b/src/us/kbase/workspace/version/WorkspaceVersion.java index 2d7947e4b..d855c9902 100644 --- a/src/us/kbase/workspace/version/WorkspaceVersion.java +++ b/src/us/kbase/workspace/version/WorkspaceVersion.java @@ -6,6 +6,6 @@ public class WorkspaceVersion { private WorkspaceVersion() {}; /** The version. */ - public static final String VERSION = "0.14.3"; + public static final String VERSION = "0.15.0"; } diff --git a/test/workspace_container_test.py b/test/workspace_container_test.py index d53a15ca3..84ef7f9e8 100644 --- a/test/workspace_container_test.py +++ b/test/workspace_container_test.py @@ -17,7 +17,7 @@ """ -WORKSPACE_VERSION = "0.14.3" +WORKSPACE_VERSION = "0.15.0" AUTH_URL = "http://localhost:8080" WS_URL = "http://localhost:7058"