Better logging.
authorJan Lahoda <jlahoda@netbeans.org>
Thu, 07 Jul 2011 20:14:12 +0200
changeset 631bc8585ff1fa1
parent 630 13aaba05893e
child 633 0404696925e7
Better logging.
remoting/server/indexer/impl/src/org/netbeans/modules/jackpot30/backend/impl/OptionProcessorImpl.java
     1.1 --- a/remoting/server/indexer/impl/src/org/netbeans/modules/jackpot30/backend/impl/OptionProcessorImpl.java	Thu Jul 07 20:13:19 2011 +0200
     1.2 +++ b/remoting/server/indexer/impl/src/org/netbeans/modules/jackpot30/backend/impl/OptionProcessorImpl.java	Thu Jul 07 20:14:12 2011 +0200
     1.3 @@ -52,6 +52,8 @@
     1.4  import java.util.Properties;
     1.5  import java.util.Set;
     1.6  import java.util.jar.JarOutputStream;
     1.7 +import java.util.logging.Level;
     1.8 +import java.util.logging.Logger;
     1.9  import java.util.zip.ZipEntry;
    1.10  import org.apache.lucene.analysis.KeywordAnalyzer;
    1.11  import org.apache.lucene.index.CorruptIndexException;
    1.12 @@ -86,6 +88,7 @@
    1.13  @ServiceProvider(service=OptionProcessor.class)
    1.14  public class OptionProcessorImpl extends OptionProcessor {
    1.15  
    1.16 +    private static final Logger LOG = Logger.getLogger(OptionProcessorImpl.class.getName());
    1.17      private final Option CATEGORY_ID = Option.requiredArgument(Option.NO_SHORT_NAME, "category-id");
    1.18      private final Option CATEGORY_NAME = Option.requiredArgument(Option.NO_SHORT_NAME, "category-name");
    1.19      private final Option CATEGORY_PROJECTS = Option.additionalArguments(Option.NO_SHORT_NAME, "category-projects");
    1.20 @@ -151,8 +154,10 @@
    1.21  
    1.22              indexProjects(roots, env);
    1.23          } catch (InterruptedException ex) {
    1.24 +            LOG.log(Level.FINE, null, ex);
    1.25              throw (CommandException) new CommandException(0).initCause(ex);
    1.26          } catch (IOException ex) {
    1.27 +            LOG.log(Level.FINE, null, ex);
    1.28              throw (CommandException) new CommandException(0).initCause(ex);
    1.29          } finally {
    1.30              if (w != null) {
    1.31 @@ -200,6 +205,7 @@
    1.32  
    1.33              out.write(("{ \"displayName\": \"" + categoryName + "\" }").getBytes("UTF-8"));
    1.34          } catch (IOException ex) {
    1.35 +            LOG.log(Level.FINE, null, ex);
    1.36              throw (CommandException) new CommandException(0).initCause(ex);
    1.37          } finally {
    1.38              if (out != null) {
    1.39 @@ -226,6 +232,7 @@
    1.40          Set<FileObject> sourceRoots = new HashSet<FileObject>(projects.length * 4 / 3 + 1);
    1.41  
    1.42          for (String p : projects) {
    1.43 +            LOG.log(Level.FINE, "Processing project specified as: {0}", p);
    1.44              File f = PropertyUtils.resolveFile(env.getCurrentDirectory(), p);
    1.45              File normalized = FileUtil.normalizeFile(f);
    1.46              FileObject prjFO = FileUtil.toFileObject(normalized);
    1.47 @@ -248,6 +255,7 @@
    1.48                      continue;
    1.49                  }
    1.50  
    1.51 +                LOG.log(Level.FINE, "project resolved: {0} ({1})", new Object[] {ProjectUtils.getInformation(prj), prj.getClass()});
    1.52                  SourceGroup[] javaSG = ProjectUtils.getSources(prj).getSourceGroups("java");
    1.53  
    1.54                  if (javaSG.length == 0) {
    1.55 @@ -256,11 +264,14 @@
    1.56                  }
    1.57  
    1.58                  for (SourceGroup sg : javaSG) {
    1.59 +                    LOG.log(Level.FINE, "Found source group: {0}", FileUtil.getFileDisplayName(sg.getRootFolder()));
    1.60                      sourceRoots.add(sg.getRootFolder());
    1.61                  }
    1.62              } catch (IOException ex) {
    1.63 +                LOG.log(Level.FINE, null, ex);
    1.64                  Exceptions.printStackTrace(ex);
    1.65              } catch (IllegalArgumentException ex) {
    1.66 +                LOG.log(Level.FINE, null, ex);
    1.67                  Exceptions.printStackTrace(ex);
    1.68              }
    1.69          }
    1.70 @@ -277,6 +288,7 @@
    1.71              org.netbeans.api.project.ui.OpenProjects.getDefault().getOpenProjects();
    1.72              ClassPath source = ClassPathSupport.createClassPath(sourceRoots.toArray(new FileObject[0]));
    1.73  
    1.74 +            LOG.log(Level.FINE, "Registering as source path: {0}", source.toString());
    1.75              GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {source});
    1.76              SourceUtils.waitScanFinished();
    1.77              GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, new ClassPath[] {source});