james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgoldst...@apache.org
Subject cvs commit: jakarta-james/src/java/org/apache/james/transport/mailets RemoteDelivery.java
Date Mon, 30 Sep 2002 23:38:58 GMT
pgoldstein    2002/09/30 16:38:58

  Modified:    src/java/org/apache/james James.java
               src/java/org/apache/james/core AvalonMailStore.java
               src/java/org/apache/james/mailrepository
                        JDBCMailRepository.java
               src/java/org/apache/james/transport JamesSpoolManager.java
               src/java/org/apache/james/transport/mailets
                        RemoteDelivery.java
  Log:
  A number of log level adjustments.  Thanks to Noel Bergman for contributions.
  
  Revision  Changes    Path
  1.34      +15 -13    jakarta-james/src/java/org/apache/james/James.java
  
  Index: James.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/James.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- James.java	29 Sep 2002 00:11:13 -0000	1.33
  +++ James.java	30 Sep 2002 23:38:57 -0000	1.34
  @@ -472,13 +472,13 @@
               }
               throw new MessagingException("Exception spooling message: " + e.getMessage(),
e);
           }
  -        if (getLogger().isInfoEnabled()) {
  +        if (getLogger().isDebugEnabled()) {
               StringBuffer logBuffer =
                   new StringBuffer(64)
                           .append("Mail ")
                           .append(mailimpl.getName())
                           .append(" pushed in spool");
  -            getLogger().info(logBuffer.toString());
  +            getLogger().debug(logBuffer.toString());
           }
       }
   
  @@ -504,7 +504,9 @@
               throw new RuntimeException("Error in getUserInbox.");
           } else {
               // need mailbox object
  -            getLogger().info("Need inbox for " + userName );
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Retrieving and caching inbox for " + userName );
  +            }
               StringBuffer destinationBuffer =
                   new StringBuffer(192)
                           .append(inboxRootURL)
  @@ -728,13 +730,15 @@
                   recipients.add(forwardTo);
                   try {
                       sendMail(sender, recipients, message);
  -                    StringBuffer logBuffer =
  -                        new StringBuffer(128)
  -                                .append("Mail for ")
  -                                .append(username)
  -                                .append(" forwarded to ")
  -                                .append(forwardTo.toString());
  -                    getLogger().info(logBuffer.toString());
  +                    if (getLogger().isInfoEnabled()) {
  +                        StringBuffer logBuffer =
  +                            new StringBuffer(128)
  +                                    .append("Mail for ")
  +                                    .append(username)
  +                                    .append(" forwarded to ")
  +                                    .append(forwardTo.toString());
  +                        getLogger().info(logBuffer.toString());
  +                    }
                       return;
                   } catch (MessagingException me) {
                       if (getLogger().isErrorEnabled()) {
  @@ -831,8 +835,6 @@
        * @param t the <code>Throwable</code> to be logged
        */
       public void log(String message, Throwable t) {
  -        //System.err.println(message);
  -        //t.printStackTrace(); //DEBUG
           getMailetLogger().info(message,t);
       }
   
  
  
  
  1.16      +11 -12    jakarta-james/src/java/org/apache/james/core/AvalonMailStore.java
  
  Index: AvalonMailStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/core/AvalonMailStore.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AvalonMailStore.java	30 Sep 2002 07:35:09 -0000	1.15
  +++ AvalonMailStore.java	30 Sep 2002 23:38:57 -0000	1.16
  @@ -165,9 +165,6 @@
           throws ConfigurationException {
           String className = repConf.getAttribute("class");
           boolean infoEnabled = getLogger().isInfoEnabled();
  -        if (infoEnabled) {
  -            getLogger().info("Registering Repository " + className);
  -        }
           Configuration[] protocols
               = repConf.getChild("protocols").getChildren("protocol");
           Configuration[] types = repConf.getChild("types").getChildren("type");
  @@ -182,21 +179,23 @@
               {
                   String type = types[j].getValue();
                   String key = protocol + type ;
  +                if (infoEnabled) {
  +                    StringBuffer infoBuffer =
  +                        new StringBuffer(128)
  +                            .append("Registering Repository instance of class ")
  +                            .append(className)
  +                            .append(" to handle ")
  +                            .append(protocol)
  +                            .append(" protocol requests for repositories of type ")
  +                            .append(type);
  +                    getLogger().info(infoBuffer.toString());
  +                }
                   if (classes.get(key) != null) {
                       throw new ConfigurationException("The combination of protocol and type
comprise a unique key for repositories.  This constraint has been violated.  Please check
your repository configuration.");
                   }
                   classes.put(key, className);
                   if (defConf != null) {
                       defaultConfigs.put(key, defConf);
  -                }
  -                if (infoEnabled) {
  -                    StringBuffer logBuffer =
  -                        new StringBuffer(128)
  -                                .append("Registered class: ")
  -                                .append(key)
  -                                .append("->")
  -                                .append(className);
  -                    getLogger().info(logBuffer.toString());
                   }
               }
           }
  
  
  
  1.27      +0 -1      jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
  
  Index: JDBCMailRepository.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- JDBCMailRepository.java	29 Sep 2002 00:04:40 -0000	1.26
  +++ JDBCMailRepository.java	30 Sep 2002 23:38:57 -0000	1.27
  @@ -456,7 +456,6 @@
        * body to the filesystem and only writes the headers to the database.
        */
       public void store(MailImpl mc) {
  -        //System.err.println("storing " + mc.getName());
           Connection conn = null;
           try {
               conn = datasource.getConnection();
  
  
  
  1.19      +41 -23    jakarta-james/src/java/org/apache/james/transport/JamesSpoolManager.java
  
  Index: JamesSpoolManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/JamesSpoolManager.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- JamesSpoolManager.java	30 Sep 2002 02:21:55 -0000	1.18
  +++ JamesSpoolManager.java	30 Sep 2002 23:38:58 -0000	1.19
  @@ -300,12 +300,11 @@
        */
       public void run() {
   
  -        boolean infoEnabled = getLogger().isInfoEnabled();
  -        if (infoEnabled)
  +        if (getLogger().isInfoEnabled())
           {
  -            getLogger().info("run JamesSpoolManager: "
  +            getLogger().info("Run JamesSpoolManager: "
                                + Thread.currentThread().getName());
  -            getLogger().info("spool=" + spool.getClass().getName());
  +            getLogger().info("Spool=" + spool.getClass().getName());
           }
   
           while(true) {
  @@ -318,13 +317,13 @@
                   if (mail == null) {
                       continue;
                   }
  -                if (infoEnabled) {
  -                    StringBuffer infoBuffer =
  +                if (getLogger().isDebugEnabled()) {
  +                    StringBuffer debugBuffer =
                           new StringBuffer(64)
                                   .append("==== Begin processing mail ")
                                   .append(mail.getName())
                                   .append("====");
  -                    getLogger().info(infoBuffer.toString());
  +                    getLogger().debug(debugBuffer.toString());
                   }
                   process(mail);
                   // Only remove an email from the spool is processing is
  @@ -333,13 +332,13 @@
                       (mail.getRecipients() == null) ||
                       (mail.getRecipients().size() == 0)) {
                       spool.remove(key);
  -                    if (infoEnabled) {
  -                        StringBuffer infoBuffer =
  +                    if (getLogger().isDebugEnabled()) {
  +                        StringBuffer debugBuffer =
                               new StringBuffer(64)
                                       .append("==== Removed from spool mail ")
                                       .append(mail.getName())
                                       .append("====");
  -                        getLogger().info(infoBuffer.toString());
  +                        getLogger().debug(debugBuffer.toString());
                       }
                   }
                   else {
  @@ -376,20 +375,37 @@
                   LinearProcessor processor
                       = (LinearProcessor)processors.get(processorName);
                   if (processor == null) {
  -                    throw new MailetException("Unable to find processor "
  -                                              + processorName);
  +                    StringBuffer exceptionMessageBuffer =
  +                        new StringBuffer(128)
  +                            .append("Unable to find processor ")
  +                            .append(processorName)
  +                            .append(" requested for processing of ")
  +                            .append(mail.getName());
  +                    String exceptionMessage = exceptionMessageBuffer.toString();
  +                    getLogger().debug(exceptionMessage);
  +                    throw new MailetException(exceptionMessage);
                   }
                   StringBuffer logMessageBuffer = null;
  -                if (getLogger().isInfoEnabled()) {
  +                if (getLogger().isDebugEnabled()) {
                       logMessageBuffer =
                           new StringBuffer(64)
                                   .append("Processing ")
                                   .append(mail.getName())
                                   .append(" through ")
                                   .append(processorName);
  -                    getLogger().info(logMessageBuffer.toString());
  +                    getLogger().debug(logMessageBuffer.toString());
                   }
                   processor.service(mail);
  +                if (getLogger().isDebugEnabled()) {
  +                    logMessageBuffer =
  +                        new StringBuffer(128)
  +                                .append("Processed")
  +                                .append(mail.getName())
  +                                .append(" through ")
  +                                .append(processorName);
  +                    getLogger().debug(logMessageBuffer.toString());
  +                    getLogger().debug("Result was " + mail.getState());
  +                }
                   return;
               } catch (Exception e) {
                   // This is a strange error situation that shouldn't ordinarily
  @@ -411,14 +427,16 @@
                       mail.setErrorMessage(e.getMessage());
                   }
               }
  -            StringBuffer logMessageBuffer =
  -                new StringBuffer(128)
  -                        .append("Processed")
  -                        .append(mail.getName())
  -                        .append(" through ")
  -                        .append(processorName);
  -            getLogger().info(logMessageBuffer.toString());
  -            getLogger().info("Result was " + mail.getState());
  +            if (getLogger().isErrorEnabled()) {
  +                StringBuffer logMessageBuffer =
  +                    new StringBuffer(128)
  +                            .append("An error occurred processing ")
  +                            .append(mail.getName())
  +                            .append(" through ")
  +                            .append(processorName);
  +                getLogger().error(logMessageBuffer.toString());
  +                getLogger().error("Result was " + mail.getState());
  +            }
           }
       }
   
  
  
  
  1.28      +2 -1      jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
  
  Index: RemoteDelivery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- RemoteDelivery.java	27 Sep 2002 00:31:22 -0000	1.27
  +++ RemoteDelivery.java	30 Sep 2002 23:38:58 -0000	1.28
  @@ -224,6 +224,7 @@
                           } finally {
                               if (transport != null) {
                                   transport.close();
  +                                transport = null;
                               }
                           }
                           logMessageBuffer =
  
  
  

--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message