You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2012/07/24 12:37:52 UTC
svn commit: r1364968 -
/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/
Author: cziegeler
Date: Tue Jul 24 10:37:51 2012
New Revision: 1364968
URL: http://svn.apache.org/viewvc?rev=1364968&view=rev
Log:
SLING-2487 : Check / Improve installer logging
Modified:
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/InstallerBundleUpdateTask.java
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/RestartActiveBundlesTask.java
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/SystemBundleUpdateTask.java
Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java?rev=1364968&r1=1364967&r2=1364968&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java Tue Jul 24 10:37:51 2012
@@ -51,8 +51,9 @@ public class BundleInstallTask extends A
final StartLevel startLevelService = this.getStartLevel();
if (startLevelService != null) {
startLevelService.setBundleStartLevel(b, startLevel);
+ ctx.log("Set start level for bundle {} to {}", b, startLevel);
} else {
- this.getLogger().warn("Ignoring start level {} for bundle {} - start level service not available.",
+ this.getLogger().info("Ignoring start level {} for bundle {} - start level service not available.",
startLevel, b);
}
}
@@ -64,10 +65,10 @@ public class BundleInstallTask extends A
} else {
final String fragmentHostHeader = BundleUtil.getFragmentHostHeader(b);
if (fragmentHostHeader != null) {
- this.getLogger().debug("Need to do a refresh of the bundle's host");
+ this.getLogger().debug("Need to do a refresh of the bundle's {} host", b);
for (final Bundle bundle : this.getBundleContext().getBundles()) {
if (fragmentHostHeader.equals(bundle.getSymbolicName())) {
- this.getLogger().debug("Found host bundle to refresh {}", bundle.getBundleId());
+ this.getLogger().debug("Found host bundle for {} to refresh: {}", b, bundle);
RefreshBundlesTask.markBundleForRefresh(ctx, this.getTaskSupport(), bundle);
break;
}
@@ -83,7 +84,7 @@ public class BundleInstallTask extends A
}
} catch (final Exception ex) {
// if something goes wrong we simply try it again
- this.getLogger().debug("Exception during install of bundle " + this.getResource() + " : " + ex.getMessage() + ". Retrying later.", ex);
+ this.getLogger().info("Exception during install of bundle " + this.getResource() + " : " + ex.getMessage() + ". Retrying later.", ex);
}
}
Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java?rev=1364968&r1=1364967&r2=1364968&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleRemoveTask.java Tue Jul 24 10:37:51 2012
@@ -63,7 +63,7 @@ public class BundleRemoveTask extends Ab
}
this.setFinishedState(ResourceState.UNINSTALLED);
} catch (final BundleException be) {
- this.getLogger().debug("Exception during removal of bundle " + this.getResource() + " : " + be.getMessage() + ". Retrying later.", be);
+ this.getLogger().info("Exception during removal of bundle " + this.getResource() + " : " + be.getMessage() + ". Retrying later.", be);
}
}
Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java?rev=1364968&r1=1364967&r2=1364968&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleStartTask.java Tue Jul 24 10:37:51 2012
@@ -79,24 +79,23 @@ public class BundleStartTask extends Abs
// and another sanity chheck
final Bundle b = this.getBundleContext().getBundle(bundleId);
if (b == null) {
- this.getLogger().info("Cannot start bundle, id not found: {}", bundleId);
+ this.getLogger().debug("Cannot start bundle, id not found: {}", bundleId);
this.setFinishedState(ResourceState.IGNORED);
return;
}
if (BundleUtil.isBundleActive(b) ) {
- this.getLogger().debug("Bundle already started, no action taken: {}/{}", bundleId, b.getSymbolicName());
+ this.getLogger().debug("Bundle already started, no action taken: {}", b);
this.setFinishedState(ResourceState.INSTALLED);
} else {
// Try to start bundle, and if that doesn't work we'll need to retry
try {
b.start();
this.setFinishedState(ResourceState.INSTALLED);
- this.getLogger().info("Bundle started (bundle ID={}) : {}",
- new Object[] {bundleId, b.getSymbolicName()});
+ ctx.log("Started bundle {}", b);
} catch (final BundleException e) {
- this.getLogger().info("Could not start bundle (bundle ID={}) : {}. Reason: {}. Will retry.",
- new Object[] {bundleId, b.getSymbolicName(), e});
+ this.getLogger().info("Could not start bundle {}. Reason: {}. Will retry.",
+ new Object[] {b, e});
}
}
}
Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java?rev=1364968&r1=1364967&r2=1364968&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java Tue Jul 24 10:37:51 2012
@@ -95,6 +95,7 @@ public class BundleUpdateTask extends Ab
final int oldStartLevel = startLevelService.getBundleStartLevel(b);
if ( newStartLevel != oldStartLevel && newStartLevel != 0 ) {
startLevelService.setBundleStartLevel(b, newStartLevel);
+ ctx.log("Set start level for bundle {} to {}", b, newStartLevel);
}
}
b.update(getResource().getInputStream());
@@ -107,10 +108,10 @@ public class BundleUpdateTask extends Ab
} else if ( BundleUtil.getFragmentHostHeader(b) != null ) {
// if this is a fragment, we're done after a refresh of the host
final String fragmentHostHeader = BundleUtil.getFragmentHostHeader(b);
- this.getLogger().debug("Need to do a refresh of the bundle's host");
+ this.getLogger().debug("Need to do a refresh of the bundle's {} host", b);
for (final Bundle bundle : this.getBundleContext().getBundles()) {
if (fragmentHostHeader.equals(bundle.getSymbolicName())) {
- this.getLogger().debug("Found host bundle to refresh {}", bundle.getBundleId());
+ this.getLogger().debug("Found host bundle for {} to refresh: {}", b, bundle);
RefreshBundlesTask.markBundleForRefresh(ctx, this.getTaskSupport(), bundle);
break;
}
@@ -124,9 +125,8 @@ public class BundleUpdateTask extends Ab
} else {
this.setFinishedState(ResourceState.INSTALLED);
}
- this.getLogger().debug("Bundle updated: {}/{}", b.getBundleId(), b.getSymbolicName());
} catch (final Exception e) {
- this.getLogger().warn("Removing failing tasks - unable to retry: " + this, e);
+ this.getLogger().info("Removing failing update task - unable to retry: " + this, e);
this.setFinishedState(ResourceState.IGNORED);
}
}
Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/InstallerBundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/InstallerBundleUpdateTask.java?rev=1364968&r1=1364967&r2=1364968&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/InstallerBundleUpdateTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/InstallerBundleUpdateTask.java Tue Jul 24 10:37:51 2012
@@ -52,13 +52,14 @@ public class InstallerBundleUpdateTask e
b.update(getResource().getInputStream());
ctx.log("Updated bundle {} from resource {}", b, getResource());
} catch (final Exception e) {
- getLogger().warn("Removing failing tasks - unable to retry: " + this, e);
+ getLogger().info("Removing failing tasks - unable to retry: " + this, e);
this.setFinishedState(ResourceState.IGNORED);
ctx.asyncTaskFailed(this);
}
} else if ( this.count == 1 ) {
// second step: refresh
this.getPackageAdmin().refreshPackages(new Bundle[] {b});
+ ctx.log("Refreshing packages for bundle {}.", b);
} else {
// finished
this.getResource().setAttribute(ASYNC_ATTR_NAME, null);
Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/RestartActiveBundlesTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/RestartActiveBundlesTask.java?rev=1364968&r1=1364967&r2=1364968&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/RestartActiveBundlesTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/RestartActiveBundlesTask.java Tue Jul 24 10:37:51 2012
@@ -72,9 +72,10 @@ public class RestartActiveBundlesTask ex
&& bundle.getState() != Bundle.UNINSTALLED) {
try {
bundle.start();
+ ctx.log("Started bundle {}", bundle);
remove.add(id);
} catch (final BundleException e) {
- ctx.log("Unable to start bundle: {}", e.getMessage());
+ getLogger().info("Unable to start bundle {} : {}", bundle, e.getMessage());
}
} else {
remove.add(id);
Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/SystemBundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/SystemBundleUpdateTask.java?rev=1364968&r1=1364967&r2=1364968&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/SystemBundleUpdateTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/SystemBundleUpdateTask.java Tue Jul 24 10:37:51 2012
@@ -56,6 +56,7 @@ public class SystemBundleUpdateTask exte
if ( this.getResource() == null ) {
try {
systemBundle.update();
+ ctx.log("Updated system bundle.");
} catch (final BundleException e) {
getLogger().warn("Updating system bundle failed - unable to retry: " + this, e);
this.setFinishedState(ResourceState.IGNORED);