directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r661704 - in /directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds: ApacheDsPluginUtils.java actions/RunAction.java jobs/LaunchServerJob.java
Date Fri, 30 May 2008 13:14:40 GMT
Author: pamarcelot
Date: Fri May 30 06:14:39 2008
New Revision: 661704

URL: http://svn.apache.org/viewvc?rev=661704&view=rev
Log:
Added a new logger that logs in the 'log' folder of the server on disk.

Modified:
    directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginUtils.java
    directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/RunAction.java
    directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java

Modified: directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginUtils.java?rev=661704&r1=661703&r2=661704&view=diff
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginUtils.java
(original)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/ApacheDsPluginUtils.java
Fri May 30 06:14:39 2008
@@ -226,7 +226,8 @@
 
             // Creating log4j.properties file
             File log4jPropertiesFile = new File( confFolder, "log4j.properties" );
-            createServersLog4jPropertiesFile( new FileOutputStream( log4jPropertiesFile ),
1024, getServerLogsLevel() ); // Setting 1024 as default port
+            createServersLog4jPropertiesFile( new FileOutputStream( log4jPropertiesFile ),
1024, getServerLogsLevel(), // Setting 1024 as default port
+                getServerLogsPattern() );
 
             // Copying server.xml file
             File serverXmlFile = new File( confFolder, "server.xml" );
@@ -253,10 +254,12 @@
      *      the port
      * @param logsLevel
      *      the logs level
+     * @param logsLevel
+     *      the logs pattern
      * @throws IOException
      *      if an error occurs when writing to the file
      */
-    public static void createServersLog4jPropertiesFile( OutputStream os, int port, String
logsLevel )
+    public static void createServersLog4jPropertiesFile( OutputStream os, int port, String
logsLevel, String logsPattern )
         throws IOException
     {
         // Creating the file content in a StringBuffer
@@ -277,12 +280,22 @@
         sb.append( "#    See the License for the specific language governing permissions
and" ).append( "\n" );
         sb.append( "#    limitations under the License." ).append( "\n" );
         sb.append( "#############################################################################"
).append( "\n" );
-        sb.append( "log4j.rootCategory=" + logsLevel + ", socketAppender" ).append( "\n"
);
+        sb.append( "log4j.rootCategory=" + logsLevel + ", socketAppender, rollingFileAppender"
).append( "\n" );
         sb.append( "" ).append( "\n" );
+        sb.append( "# The Socket Appender (used to send the logs to Apache Directory Studio)"
).append( "\n" );
         sb.append( "log4j.appender.socketAppender=org.apache.log4j.net.SocketAppender" ).append(
"\n" );
         sb.append( "log4j.appender.socketAppender.RemoteHost=localhost" ).append( "\n" );
         sb.append( "log4j.appender.socketAppender.Port=" ).append( port ).append( "\n" );
         sb.append( "" ).append( "\n" );
+        sb.append( "# The Rolling File Appender" ).append( "\n" );
+        sb.append( "log4j.appender.rollingFileAppender=org.apache.log4j.RollingFileAppender"
).append( "\n" );
+        sb.append( "log4j.appender.rollingFileAppender.File=${apacheds.log.dir}/apacheds-rolling.log"
).append( "\n" );
+        sb.append( "log4j.appender.rollingFileAppender.MaxFileSize=1024KB" ).append( "\n"
);
+        sb.append( "log4j.appender.rollingFileAppender.MaxBackupIndex=5" ).append( "\n" );
+        sb.append( "log4j.appender.rollingFileAppender.layout=org.apache.log4j.PatternLayout"
).append( "\n" );
+        sb.append( "log4j.appender.rollingFileAppender.layout.ConversionPattern=[%d{HH:mm:ss}]
%p [%c] - %m%n" )
+            .append( "\n" );
+        sb.append( "" ).append( "\n" );
         sb.append( "# with these we'll not get innundated when switching to DEBUG" ).append(
"\n" );
         sb.append( "log4j.logger.org.apache.directory.shared.ldap.name=WARN" ).append( "\n"
);
         sb.append( "log4j.logger.org.springframework=WARN" ).append( "\n" );

Modified: directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/RunAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/RunAction.java?rev=661704&r1=661703&r2=661704&view=diff
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/RunAction.java
(original)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/actions/RunAction.java
Fri May 30 06:14:39 2008
@@ -154,6 +154,7 @@
             // Creating, setting and launching the launch job
             LaunchServerJob job = new LaunchServerJob( server, serverConfiguration );
             job.setLogsLevel( ApacheDsPluginUtils.getServerLogsLevel() );
+            job.setLogsPattern( ApacheDsPluginUtils.getServerLogsPattern() );
             server.setLaunchJob( job );
             job.schedule();
         }

Modified: directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java?rev=661704&r1=661703&r2=661704&view=diff
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java
(original)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java
Fri May 30 06:14:39 2008
@@ -83,9 +83,12 @@
     /** The minimum port number for the socket server */
     private static final int MIN_PORT = 1024;
 
-    /** The log level */
+    /** The logs level */
     private String logsLevel = "WARN";
 
+    /** The logs pattern */
+    private String logsPattern = "[%d{HH:mm:ss}] %p [%c] - %m%n";
+
 
     /**
      * Creates a new instance of LaunchServerJob.
@@ -359,7 +362,7 @@
         IPath confFolderPath = ApacheDsPluginUtils.getApacheDsServersFolder().append( server.getId()
).append( "conf" );
         File confFolder = new File( confFolderPath.toOSString() );
         ApacheDsPluginUtils.createServersLog4jPropertiesFile( new FileOutputStream( new File(
confFolder,
-            "log4j.properties" ) ), port, logsLevel );
+            "log4j.properties" ) ), port, logsLevel, logsPattern );
     }
 
 
@@ -493,4 +496,16 @@
     {
         this.logsLevel = logsLevel;
     }
+
+
+    /**
+     * Sets the logs pattern.
+     *
+     * @param logsPattern
+     *      the logs pattern
+     */
+    public void setLogsPattern( String logsPattern )
+    {
+        this.logsPattern = logsPattern;
+    }
 }



Mime
View raw message