Skip to content

Commit

Permalink
Enhancement of the initialization of the Isolate Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
ogattaz committed Jul 13, 2015
1 parent f755d17 commit a9966c8
Showing 1 changed file with 13 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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());
Expand All @@ -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());
}

/**
Expand Down Expand Up @@ -536,7 +528,7 @@ private void removeRegistrationListener(final BundleContext aBundleContext) {

/*
* (non-Javadoc)
*
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
Expand Down Expand Up @@ -613,7 +605,7 @@ public void start(final BundleContext aBundleContext) {

/*
* (non-Javadoc)
*
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
Expand Down

0 comments on commit a9966c8

Please sign in to comment.