From a9966c8f9658b87c70c9738ed0c2eb345c224cbb Mon Sep 17 00:00:00 2001 From: ogattaz Date: Mon, 13 Jul 2015 18:10:12 +0200 Subject: [PATCH] Enhancement of the initialization of the Isolate Logger --- .../base/internal/CBundleBaseActivator.java | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/java/boot/org.psem2m.isolates.base/src/org/psem2m/isolates/base/internal/CBundleBaseActivator.java b/java/boot/org.psem2m.isolates.base/src/org/psem2m/isolates/base/internal/CBundleBaseActivator.java index 8426326e..e52b0f3f 100644 --- a/java/boot/org.psem2m.isolates.base/src/org/psem2m/isolates/base/internal/CBundleBaseActivator.java +++ b/java/boot/org.psem2m.isolates.base/src/org/psem2m/isolates/base/internal/CBundleBaseActivator.java @@ -325,6 +325,13 @@ public boolean hasIsolateLoggerSvc() { */ private void initLogger(final BundleContext aBundleContext) { + String wIsolateName = aBundleContext + .getProperty(IPlatformProperties.PROP_ISOLATE_NAME); + + if (wIsolateName == null || wIsolateName.isEmpty()) { + wIsolateName = "IsolateX"; + } + try { // Be sure we have a valid platform service instance final IPlatformDirsSvc wPlatformDirsSvc = getPlatformDirs(); @@ -333,13 +340,6 @@ private void initLogger(final BundleContext aBundleContext) { final String wLoggerName = "cohorte.isolate." + wPlatformDirsSvc.getIsolateUID(); - String wIsolateName = aBundleContext - .getProperty(IPlatformProperties.PROP_ISOLATE_NAME); - - if (wIsolateName == null || wIsolateName.isEmpty()) { - wIsolateName = "IsolateX"; - } - // the FilePathPattern of the logger final StringBuilder wSB = new StringBuilder(); wSB.append(wPlatformDirsSvc.getIsolateLogDir().getAbsolutePath()); @@ -355,24 +355,16 @@ private void initLogger(final BundleContext aBundleContext) { wFilePathPattern, IActivityLoggerBase.ALL, LOG_FILES_SIZE, LOG_FILES_COUNT); - // log the name - pActivityLogger.logInfo(this, "initLogger", - "LoggerName=[%s] FilePathPattern=[%s] ", wLoggerName, - wFilePathPattern); - } catch (final Exception e) { pActivityLogger = CActivityLoggerBasicConsole.getInstance(); pActivityLogger.logSevere(this, "initLogger", "Can't instanciate a CIsolateLoggerChannel", e); } - // add the java context - pActivityLogger - .logInfo(this, "initLogger", CXJvmUtils.getJavaContext()); - - // add the environment context - pActivityLogger.logInfo(this, "initLogger", CXOSUtils.getEnvContext()); - + // Logs the isolatename, the java context and the environment context + pActivityLogger.logInfo(this, "initLogger", + "Logger of the isolate=[%s] %s %s", wIsolateName, + CXJvmUtils.getJavaContext(), CXOSUtils.getEnvContext()); } /** @@ -536,7 +528,7 @@ private void removeRegistrationListener(final BundleContext aBundleContext) { /* * (non-Javadoc) - * + * * @see * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext * ) @@ -613,7 +605,7 @@ public void start(final BundleContext aBundleContext) { /* * (non-Javadoc) - * + * * @see * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */