You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2021/05/16 14:01:38 UTC

[directory-studio] 01/02: DIRSTUDIO-1273, DIRSTUDIO-1276: Fix illegal reflective access and fix logs views with Java 16+

This is an automated email from the ASF dual-hosted git repository.

seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-studio.git

commit 738bc78cbb8b1f9a32008b2924d23accc3cc6f2a
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Sun May 16 14:43:22 2021 +0200

    DIRSTUDIO-1273, DIRSTUDIO-1276: Fix illegal reflective access and fix logs views with Java 16+
---
 .../studio/connection/core/ILdapLogger.java        |   7 +-
 .../core/io/api/LdifModificationLogger.java        | 152 +++----
 .../connection/core/io/api/LdifSearchLogger.java   | 155 +++----
 .../ui/views/modificationlogs/ClearAction.java     |   2 +-
 .../ui/views/searchlogs/ClearAction.java           |   2 +-
 .../test/integration/junit5/TestFixture.java       |   2 +
 .../studio/test/integration/ui/LogsViewsTest.java  | 446 +++++++++++++++++++++
 .../integration/ui/bots/AbstractLogsViewBot.java   |  42 +-
 .../ui/bots/ModificationLogsViewBot.java           |  11 +
 .../integration/ui/bots/SearchLogsViewBot.java     |  25 ++
 10 files changed, 661 insertions(+), 183 deletions(-)

diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java
index d9adcbb..8d56186 100644
--- a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/ILdapLogger.java
@@ -35,6 +35,7 @@ import org.apache.directory.api.util.Strings;
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.io.StudioLdapException;
 import org.apache.directory.studio.connection.core.io.api.StudioSearchResult;
+import org.eclipse.core.runtime.Platform;
 
 
 /**
@@ -223,13 +224,13 @@ public interface ILdapLogger
     {
         Set<String> maskedAttributes = new HashSet<String>();
 
-        String maskedAttributeString = ConnectionCorePlugin.getDefault().getPluginPreferences().getString(
-            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_MASKED_ATTRIBUTES );
+        String maskedAttributeString = Platform.getPreferencesService().getString( ConnectionCoreConstants.PLUGIN_ID,
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_MASKED_ATTRIBUTES, "", null );
         String[] splitted = maskedAttributeString.split( "," ); //$NON-NLS-1$
 
         for ( String s : splitted )
         {
-            maskedAttributes.add( Strings.toLowerCase( s ) );
+            maskedAttributes.add( Strings.toLowerCaseAscii( s ) );
         }
 
         return maskedAttributes;
diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java
index 3d8895d..c0c6c70 100644
--- a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifModificationLogger.java
@@ -23,14 +23,15 @@ package org.apache.directory.studio.connection.core.io.api;
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.reflect.Field;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.StringJoiner;
 import java.util.logging.FileHandler;
 import java.util.logging.Formatter;
 import java.util.logging.Handler;
@@ -70,8 +71,9 @@ import org.apache.directory.studio.ldifparser.model.lines.LdifModSpecSepLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifNewrdnLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifNewsuperiorLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifSepLine;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
 
 
 /**
@@ -97,52 +99,48 @@ public class LdifModificationLogger implements ILdapLogger
     /** The loggers. */
     private Map<String, Logger> loggers = new HashMap<String, Logger>();
 
-
     /**
      * Creates a new instance of LdifModificationLogger.
      */
     public LdifModificationLogger()
     {
-        ConnectionCorePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(
-            new IPropertyChangeListener()
+        IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode( ConnectionCoreConstants.PLUGIN_ID );
+        prefs.addPreferenceChangeListener( event -> {
+            if ( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT.equals( event.getKey() )
+                || ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE.equals( event.getKey() ) )
             {
-                public void propertyChange( PropertyChangeEvent event )
+                // dispose all loggers/handlers
+                for ( Logger logger : loggers.values() )
                 {
-                    if ( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT.equals( event.getProperty() )
-                        || ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE.equals( event.getProperty() ) )
+                    for ( Handler handler : logger.getHandlers() )
                     {
-                        // dispose all loggers/handlers
-                        for ( Logger logger : loggers.values() )
-                        {
-                            for ( Handler handler : logger.getHandlers() )
-                            {
-                                handler.close();
-                            }
-                        }
+                        handler.close();
+                    }
+                }
 
-                        // delete files with index greater than new file count
-                        for ( FileHandler fh : fileHandlers.values() )
+                // delete files with index greater than new file count
+                Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
+                for ( Connection connection : connections )
+                {
+                    try
+                    {
+                        File[] logFiles = getLogFiles( connection );
+                        for ( int i = getFileCount(); i < logFiles.length; i++ )
                         {
-                            try
-                            {
-                                File[] logFiles = getLogFiles( fh );
-                                for ( int i = getFileCount(); i < logFiles.length; i++ )
-                                {
-                                    if ( logFiles[i] != null && logFiles[i].exists() )
-                                    {
-                                        logFiles[i].delete();
-                                    }
-                                }
-                            }
-                            catch ( Exception e )
+                            if ( logFiles[i] != null && logFiles[i].exists() )
                             {
+                                logFiles[i].delete();
                             }
                         }
-
-                        loggers.clear();
+                    }
+                    catch ( Exception e )
+                    {
                     }
                 }
-            } );
+
+                loggers.clear();
+            }
+        } );
     }
 
 
@@ -214,28 +212,26 @@ public class LdifModificationLogger implements ILdapLogger
 
         if ( loggers.containsKey( id ) )
         {
-            Logger logger = loggers.get( id );
+            StringJoiner lines = new StringJoiner( "" );
             DateFormat df = new SimpleDateFormat( ConnectionCoreConstants.DATEFORMAT );
             df.setTimeZone( ConnectionCoreConstants.UTC_TIME_ZONE );
 
             if ( ex != null )
             {
-                logger.log( Level.ALL, LdifCommentLine
+                lines.add( LdifCommentLine
                     .create( "#!RESULT ERROR" ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$
             }
             else
             {
-                logger.log( Level.ALL, LdifCommentLine
+                lines.add( LdifCommentLine
                     .create( "#!RESULT OK" ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$
             }
 
-            logger
-                .log(
-                    Level.ALL,
-                    LdifCommentLine
-                        .create( "#!CONNECTION ldap://" + connection.getHost() + ":" + connection.getPort() ) //$NON-NLS-1$//$NON-NLS-2$
-                        .toFormattedString( LdifFormatParameters.DEFAULT ) );
-            logger.log( Level.ALL, LdifCommentLine
+            lines.add(
+                LdifCommentLine
+                    .create( "#!CONNECTION ldap://" + connection.getHost() + ":" + connection.getPort() ) //$NON-NLS-1$//$NON-NLS-2$
+                    .toFormattedString( LdifFormatParameters.DEFAULT ) );
+            lines.add( LdifCommentLine
                 .create( "#!DATE " + df.format( new Date() ) ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$
 
             if ( ex != null )
@@ -244,10 +240,12 @@ public class LdifModificationLogger implements ILdapLogger
                 errorComment = errorComment.replaceAll( "\r", " " ); //$NON-NLS-1$ //$NON-NLS-2$
                 errorComment = errorComment.replaceAll( "\n", " " ); //$NON-NLS-1$ //$NON-NLS-2$
                 LdifCommentLine errorCommentLine = LdifCommentLine.create( errorComment );
-                logger.log( Level.ALL, errorCommentLine.toFormattedString( LdifFormatParameters.DEFAULT ) );
+                lines.add( errorCommentLine.toFormattedString( LdifFormatParameters.DEFAULT ) );
             }
 
-            logger.log( Level.ALL, text );
+            lines.add( text );
+            Logger logger = loggers.get( id );
+            logger.log( Level.ALL, lines.toString() );
         }
     }
 
@@ -255,7 +253,8 @@ public class LdifModificationLogger implements ILdapLogger
     /**
      * {@inheritDoc}
      */
-    public void logChangetypeAdd( Connection connection, final Entry entry, final Control[] controls, StudioLdapException ex )
+    public void logChangetypeAdd( Connection connection, final Entry entry, final Control[] controls,
+        StudioLdapException ex )
     {
         if ( !isModificationLogEnabled() )
         {
@@ -271,7 +270,7 @@ public class LdifModificationLogger implements ILdapLogger
             String attributeName = attribute.getUpId();
             for ( Value value : attribute )
             {
-                if ( maskedAttributes.contains( Strings.toLowerCase( attributeName ) ) )
+                if ( maskedAttributes.contains( Strings.toLowerCaseAscii( attributeName ) ) )
                 {
                     record.addAttrVal( LdifAttrValLine.create( attributeName, "**********" ) ); //$NON-NLS-1$
                 }
@@ -351,7 +350,7 @@ public class LdifModificationLogger implements ILdapLogger
             }
             for ( Value value : item.getAttribute() )
             {
-                if ( maskedAttributes.contains( Strings.toLowerCase( attributeName ) ) )
+                if ( maskedAttributes.contains( Strings.toLowerCaseAscii( attributeName ) ) )
                 {
                     modSpec.addAttrVal( LdifAttrValLine.create( attributeName, "**********" ) ); //$NON-NLS-1$
                 }
@@ -411,7 +410,7 @@ public class LdifModificationLogger implements ILdapLogger
      * @param record the recored
      * @param controls the controls
      */
-    private static void addControlLines( LdifChangeRecord record,Control[] controls )
+    private static void addControlLines( LdifChangeRecord record, Control[] controls )
     {
         if ( controls != null )
         {
@@ -447,7 +446,7 @@ public class LdifModificationLogger implements ILdapLogger
 
         try
         {
-            return getLogFiles( fileHandlers.get( id ) );
+            return getLogFiles( connection );
         }
         catch ( Exception e )
         {
@@ -462,51 +461,30 @@ public class LdifModificationLogger implements ILdapLogger
      * @param fileHandler the file handler
      * 
      * @return the log files
-     * 
-     * @throws Exception the exception
      */
-    private static File[] getLogFiles( FileHandler fileHandler ) throws Exception
+    private static File[] getLogFiles( Connection connection )
     {
-        Field field = getFieldFromClass( "java.util.logging.FileHandler", "files" ); //$NON-NLS-1$ //$NON-NLS-2$
-        field.setAccessible( true );
-        File[] files = ( File[] ) field.get( fileHandler );
+        String logfileNamePattern = ConnectionManager.getModificationLogFileName( connection );
+        File file = new File( logfileNamePattern );
+        String pattern = file.getName().replace( "%u", "\\d+" ).replace( "%g", "\\d+" );
+        File dir = file.getParentFile();
+        File[] files = dir.listFiles( ( d, f ) -> {
+            return f.matches( pattern );
+        } );
+        Arrays.sort( files );
         return files;
     }
 
 
     /**
-     * Gets the field from class.
-     * 
-     * @param className the class name
-     * @param fieldName the field name
-     * 
-     * @return the field from class
-     * 
-     * @throws Exception the exception
-     */
-    private static Field getFieldFromClass( String className, String fieldName ) throws Exception
-    {
-        Class<?> clazz = Class.forName( className );
-        Field[] fields = clazz.getDeclaredFields();
-
-        for ( int i = 0; i < fields.length; i++ )
-        {
-            if ( fields[i].getName().equals( fieldName ) )
-                return fields[i];
-        }
-        return null;
-    }
-
-
-    /**
      * Checks if modification log is enabled.
      * 
      * @return true, if modification log is enabled
      */
     private boolean isModificationLogEnabled()
     {
-        return ConnectionCorePlugin.getDefault().getPluginPreferences().getBoolean(
-            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_ENABLE );
+        return Platform.getPreferencesService().getBoolean( ConnectionCoreConstants.PLUGIN_ID,
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_ENABLE, true, null );
     }
 
 
@@ -517,8 +495,8 @@ public class LdifModificationLogger implements ILdapLogger
      */
     private int getFileCount()
     {
-        return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
-            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT );
+        return Platform.getPreferencesService().getInt( ConnectionCoreConstants.PLUGIN_ID,
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT, 10, null );
     }
 
 
@@ -529,8 +507,8 @@ public class LdifModificationLogger implements ILdapLogger
      */
     private int getFileSizeInKb()
     {
-        return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
-            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE );
+        return Platform.getPreferencesService().getInt( ConnectionCoreConstants.PLUGIN_ID,
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE, 100, null );
     }
 
 
diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java
index 241adb7..f20e048 100644
--- a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/LdifSearchLogger.java
@@ -23,15 +23,16 @@ package org.apache.directory.studio.connection.core.io.api;
 
 import java.io.File;
 import java.io.IOException;
-import java.lang.reflect.Field;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.StringJoiner;
 import java.util.logging.FileHandler;
 import java.util.logging.Formatter;
 import java.util.logging.Handler;
@@ -65,8 +66,9 @@ import org.apache.directory.studio.ldifparser.model.lines.LdifCommentLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifLineBase;
 import org.apache.directory.studio.ldifparser.model.lines.LdifSepLine;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
 
 
 /**
@@ -92,52 +94,48 @@ public class LdifSearchLogger implements ILdapLogger
     /** The loggers. */
     private Map<String, Logger> loggers = new HashMap<String, Logger>();
 
-
     /**
      * Creates a new instance of LdifSearchLogger.
      */
     public LdifSearchLogger()
     {
-        ConnectionCorePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(
-            new IPropertyChangeListener()
+        IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode( ConnectionCoreConstants.PLUGIN_ID );
+        prefs.addPreferenceChangeListener( event -> {
+            if ( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT.equals( event.getKey() )
+                || ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE.equals( event.getKey() ) )
             {
-                public void propertyChange( PropertyChangeEvent event )
+                // dispose all loggers/handlers
+                for ( Logger logger : loggers.values() )
                 {
-                    if ( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT.equals( event.getProperty() )
-                        || ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE.equals( event.getProperty() ) )
+                    for ( Handler handler : logger.getHandlers() )
                     {
-                        // dispose all loggers/handlers
-                        for ( Logger logger : loggers.values() )
-                        {
-                            for ( Handler handler : logger.getHandlers() )
-                            {
-                                handler.close();
-                            }
-                        }
+                        handler.close();
+                    }
+                }
 
-                        // delete files with index greater than new file count
-                        for ( FileHandler fh : fileHandlers.values() )
+                // delete files with index greater than new file count
+                Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
+                for ( Connection connection : connections )
+                {
+                    try
+                    {
+                        File[] logFiles = getLogFiles( connection );
+                        for ( int i = getFileCount(); i < logFiles.length; i++ )
                         {
-                            try
-                            {
-                                File[] logFiles = getLogFiles( fh );
-                                for ( int i = getFileCount(); i < logFiles.length; i++ )
-                                {
-                                    if ( logFiles[i] != null && logFiles[i].exists() )
-                                    {
-                                        logFiles[i].delete();
-                                    }
-                                }
-                            }
-                            catch ( Exception e )
+                            if ( logFiles[i] != null && logFiles[i].exists() )
                             {
+                                logFiles[i].delete();
                             }
                         }
-
-                        loggers.clear();
+                    }
+                    catch ( Exception e )
+                    {
                     }
                 }
-            } );
+
+                loggers.clear();
+            }
+        } );
     }
 
 
@@ -209,29 +207,27 @@ public class LdifSearchLogger implements ILdapLogger
 
         if ( loggers.containsKey( id ) )
         {
-            Logger logger = loggers.get( id );
+            StringJoiner lines = new StringJoiner( "" );
             DateFormat df = new SimpleDateFormat( ConnectionCoreConstants.DATEFORMAT );
             df.setTimeZone( ConnectionCoreConstants.UTC_TIME_ZONE );
 
             if ( ex != null )
             {
-                logger.log( Level.ALL, LdifCommentLine
-                    .create( "#!" + type + " ERROR" ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                lines.add( LdifCommentLine.create( "#!" + type + " ERROR" ) //$NON-NLS-1$//$NON-NLS-2$
+                    .toFormattedString( LdifFormatParameters.DEFAULT ) );
             }
             else
             {
-                logger.log( Level.ALL, LdifCommentLine
-                    .create( "#!" + type + " OK" ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$ //$NON-NLS-2$
+                lines.add( LdifCommentLine.create( "#!" + type + " OK" ) //$NON-NLS-1$ //$NON-NLS-2$
+                    .toFormattedString( LdifFormatParameters.DEFAULT ) );
             }
 
-            logger
-                .log(
-                    Level.ALL,
-                    LdifCommentLine
-                        .create( "#!CONNECTION ldap://" + connection.getHost() + ":" + connection.getPort() ) //$NON-NLS-1$//$NON-NLS-2$
-                        .toFormattedString( LdifFormatParameters.DEFAULT ) );
-            logger.log( Level.ALL, LdifCommentLine
-                .create( "#!DATE " + df.format( new Date() ) ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$
+            lines.add(
+                LdifCommentLine
+                    .create( "#!CONNECTION ldap://" + connection.getHost() + ":" + connection.getPort() ) //$NON-NLS-1$//$NON-NLS-2$
+                    .toFormattedString( LdifFormatParameters.DEFAULT ) );
+            lines.add( LdifCommentLine.create( "#!DATE " + df.format( new Date() ) ) //$NON-NLS-1$
+                .toFormattedString( LdifFormatParameters.DEFAULT ) );
 
             if ( ex != null )
             {
@@ -239,10 +235,12 @@ public class LdifSearchLogger implements ILdapLogger
                 errorComment = errorComment.replaceAll( "\r", " " ); //$NON-NLS-1$ //$NON-NLS-2$
                 errorComment = errorComment.replaceAll( "\n", " " ); //$NON-NLS-1$ //$NON-NLS-2$
                 LdifCommentLine errorCommentLine = LdifCommentLine.create( errorComment );
-                logger.log( Level.ALL, errorCommentLine.toFormattedString( LdifFormatParameters.DEFAULT ) );
+                lines.add( errorCommentLine.toFormattedString( LdifFormatParameters.DEFAULT ) );
             }
 
-            logger.log( Level.ALL, text );
+            lines.add( text );
+            Logger logger = loggers.get( id );
+            logger.log( Level.ALL, lines.toString() );
         }
     }
 
@@ -334,7 +332,7 @@ public class LdifSearchLogger implements ILdapLogger
                 String attributeName = attribute.getUpId();
                 for ( Value value : attribute )
                 {
-                    if ( maskedAttributes.contains( Strings.toLowerCase( attributeName ) ) )
+                    if ( maskedAttributes.contains( Strings.toLowerCaseAscii( attributeName ) ) )
                     {
                         record.addAttrVal( LdifAttrValLine.create( attributeName, "**********" ) ); //$NON-NLS-1$
                     }
@@ -431,7 +429,7 @@ public class LdifSearchLogger implements ILdapLogger
 
         try
         {
-            return getLogFiles( fileHandlers.get( id ) );
+            return getLogFiles( connection );
         }
         catch ( Exception e )
         {
@@ -446,51 +444,30 @@ public class LdifSearchLogger implements ILdapLogger
      * @param fileHandler the file handler
      * 
      * @return the log files
-     * 
-     * @throws Exception the exception
      */
-    private static File[] getLogFiles( FileHandler fileHandler ) throws Exception
+    private static File[] getLogFiles( Connection connection )
     {
-        Field field = getFieldFromClass( "java.util.logging.FileHandler", "files" ); //$NON-NLS-1$ //$NON-NLS-2$
-        field.setAccessible( true );
-        File[] files = ( File[] ) field.get( fileHandler );
+        String logfileNamePattern = ConnectionManager.getSearchLogFileName( connection );
+        File file = new File( logfileNamePattern );
+        String pattern = file.getName().replace( "%u", "\\d+" ).replace( "%g", "\\d+" );
+        File dir = file.getParentFile();
+        File[] files = dir.listFiles( ( d, f ) -> {
+            return f.matches( pattern );
+        } );
+        Arrays.sort( files );
         return files;
     }
 
 
     /**
-     * Gets the field from class.
-     * 
-     * @param className the class name
-     * @param fieldName the field name
-     * 
-     * @return the field from class
-     * 
-     * @throws Exception the exception
-     */
-    private static Field getFieldFromClass( String className, String fieldName ) throws Exception
-    {
-        Class<?> clazz = Class.forName( className );
-        Field[] fields = clazz.getDeclaredFields();
-
-        for ( int i = 0; i < fields.length; i++ )
-        {
-            if ( fields[i].getName().equals( fieldName ) )
-                return fields[i];
-        }
-        return null;
-    }
-
-
-    /**
      * Checks if search request log is enabled.
      * 
      * @return true, if search request log is enabled
      */
     private boolean isSearchRequestLogEnabled()
     {
-        return ConnectionCorePlugin.getDefault().getPluginPreferences().getBoolean(
-            ConnectionCoreConstants.PREFERENCE_SEARCHREQUESTLOGS_ENABLE );
+        return Platform.getPreferencesService().getBoolean( ConnectionCoreConstants.PLUGIN_ID,
+            ConnectionCoreConstants.PREFERENCE_SEARCHREQUESTLOGS_ENABLE, true, null );
     }
 
 
@@ -501,8 +478,8 @@ public class LdifSearchLogger implements ILdapLogger
      */
     private boolean isSearchResultEntryLogEnabled()
     {
-        return ConnectionCorePlugin.getDefault().getPluginPreferences().getBoolean(
-            ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE );
+        return Platform.getPreferencesService().getBoolean( ConnectionCoreConstants.PLUGIN_ID,
+            ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE, false, null );
     }
 
 
@@ -513,8 +490,8 @@ public class LdifSearchLogger implements ILdapLogger
      */
     private int getFileCount()
     {
-        return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
-            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT );
+        return Platform.getPreferencesService().getInt( ConnectionCoreConstants.PLUGIN_ID,
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT, 10, null );
     }
 
 
@@ -525,8 +502,8 @@ public class LdifSearchLogger implements ILdapLogger
      */
     private int getFileSizeInKb()
     {
-        return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
-            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE );
+        return Platform.getPreferencesService().getInt( ConnectionCoreConstants.PLUGIN_ID,
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE, 100, null );
     }
 
 
diff --git a/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ClearAction.java b/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ClearAction.java
index ba18ada..f6086c5 100644
--- a/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ClearAction.java
+++ b/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ClearAction.java
@@ -96,8 +96,8 @@ public class ClearAction extends BrowserAction
             Messages.getString( "ClearAction.Delete" ), Messages.getString( "ClearAction.DeleteAllLogFiles" ) ) ) //$NON-NLS-1$ //$NON-NLS-2$
         {
             view.getUniversalListener().clearInput();
+            new RefreshAction( view ).run();
         }
-
     }
 
 
diff --git a/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ClearAction.java b/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ClearAction.java
index bac29d7..296acb4 100644
--- a/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ClearAction.java
+++ b/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ClearAction.java
@@ -97,8 +97,8 @@ public class ClearAction extends BrowserAction
             Messages.getString( "ClearAction.Delete" ), Messages.getString( "ClearAction.DeleteAllLogFiles" ) ) ) //$NON-NLS-1$ //$NON-NLS-2$
         {
             view.getUniversalListener().clearInput();
+            new RefreshAction( view ).run();
         }
-
     }
 
 
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
index 879a894..7f87e2a 100644
--- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
@@ -122,6 +122,8 @@ public class TestFixture
     public static final Dn USER1_DN = dn( "uid=user.1", USERS_DN );
     public static final Dn USER2_DN = dn( "uid=user.2", USERS_DN );
     public static final Dn USER3_DN = dn( "uid=user.3", USERS_DN );
+    public static final Dn USER4_DN = dn( "uid=user.4", USERS_DN );
+    public static final Dn USER5_DN = dn( "uid=user.5", USERS_DN );
     public static final Dn USER8_DN = dn( "uid=user.8", USERS_DN );
 
     public static final Dn GROUPS_DN = dn( "ou=groups", CONTEXT_DN );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LogsViewsTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LogsViewsTest.java
new file mode 100644
index 0000000..65eac80
--- /dev/null
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LogsViewsTest.java
@@ -0,0 +1,446 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.ui;
+
+
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.GROUPS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.TARGET_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER2_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER3_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER4_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER5_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.ArrayList;
+import java.util.IntSummaryStatistics;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.ui.bots.SelectCopyDepthDialogBot;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.params.ParameterizedTest;
+
+
+/**
+ * Tests the modification and search logs views.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LogsViewsTest extends AbstractTestBase
+{
+
+    @AfterEach
+    public void reset() throws Exception
+    {
+        IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode( ConnectionCoreConstants.PLUGIN_ID );
+        prefs.remove( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT );
+        prefs.remove( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE );
+        prefs.remove( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT );
+        prefs.remove( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE );
+        prefs.remove( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_MASKED_ATTRIBUTES );
+        searchLogsViewBot.enableSearchRequestLogs( true );
+        searchLogsViewBot.enableSearchResultEntryLogs( false );
+        modificationLogsViewBot.enableModificationLogs( true );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource
+    public void testSearchLogsViewDefault( TestLdapServer server ) throws Exception
+    {
+        // create and open connection
+        connectionsViewBot.createTestConnection( server );
+        searchLogsViewBot.clear();
+
+        // select groups entry
+        browserViewBot.selectAndExpandEntry( path( USERS_DN ) );
+
+        // assert content (ou=users)
+        String text = searchLogsViewBot.getSearchLogsText();
+
+        assertThat( text, containsString( "#!SEARCH REQUEST " ) );
+        assertThat( text, containsString( "#!CONNECTION " + server.getLdapUrl() ) );
+        assertThat( text, containsString( "#!DATE " ) );
+        assertThat( text, containsString( "# LDAP URL     : " + server.getLdapUrl()
+            + "/ou=users,dc=example,dc=org?hasSubordinates,objectClass?one?(objectClass=*)" ) );
+        assertThat( text, containsString( "# command line : ldapsearch -H " + server.getLdapUrl() + " -x -D \""
+            + server.getAdminDn()
+            + "\" -W -b \"ou=users,dc=example,dc=org\" -s one -a always -z 1000 \"(objectClass=*)\" \"hasSubordinates\" \"objectClass\"" ) );
+        assertThat( text, containsString( "# baseObject   : ou=users,dc=example,dc=org" ) );
+        assertThat( text, containsString( "# scope        : singleLevel (1)" ) );
+        assertThat( text, containsString( "# derefAliases : derefAlways (3)" ) );
+        assertThat( text, containsString( "# sizeLimit    : 1000" ) );
+        assertThat( text, containsString( "# timeLimit    : 0" ) );
+        assertThat( text, containsString( "# typesOnly    : False" ) );
+        assertThat( text, containsString( "# filter       : (objectClass=*)" ) );
+        assertThat( text, containsString( "# attributes   : hasSubordinates objectClass" ) );
+
+        assertThat( text, not( containsString( "#!SEARCH RESULT ENTRY" ) ) );
+
+        assertThat( text, containsString( "#!SEARCH RESULT DONE " ) );
+        assertThat( text, containsString( "# numEntries : 8" ) );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource
+    public void testSearchLogsViewWithSearchResultEntryLogsEnabled( TestLdapServer server ) throws Exception
+    {
+        connectionsViewBot.createTestConnection( server );
+        searchLogsViewBot.clear();
+
+        // enable search result entry logs
+        searchLogsViewBot.enableSearchResultEntryLogs( true );
+
+        // select entry (ou=groups)
+        browserViewBot.selectEntry( path( GROUPS_DN ) );
+
+        // assert content
+        String text = searchLogsViewBot.getSearchLogsText();
+
+        assertThat( text, containsString( "#!SEARCH REQUEST " ) );
+        assertThat( text, containsString( "#!CONNECTION " + server.getLdapUrl() ) );
+        assertThat( text, containsString( "#!DATE " ) );
+        assertThat( text, containsString(
+            "# LDAP URL     : " + server.getLdapUrl() + "/ou=groups,dc=example,dc=org?*??(objectClass=*)" ) );
+        assertThat( text, containsString( "# command line : ldapsearch -H " + server.getLdapUrl() + " -x -D \""
+            + server.getAdminDn()
+            + "\" -W -b \"ou=groups,dc=example,dc=org\" -s base -a always \"(objectClass=*)\" \"*\"" ) );
+        assertThat( text, containsString( "# baseObject   : ou=groups,dc=example,dc=org" ) );
+        assertThat( text, containsString( "# scope        : baseObject (0)" ) );
+        assertThat( text, containsString( "# derefAliases : derefAlways (3)" ) );
+        assertThat( text, containsString( "# sizeLimit    : 0" ) );
+        assertThat( text, containsString( "# timeLimit    : 0" ) );
+        assertThat( text, containsString( "# typesOnly    : False" ) );
+        assertThat( text, containsString( "# filter       : (objectClass=*)" ) );
+        assertThat( text, containsString( "# attributes   : *" ) );
+
+        assertThat( text, containsString( "#!SEARCH RESULT ENTRY" ) );
+        assertThat( text, containsString( "dn: ou=groups,dc=example,dc=org" ) );
+        assertThat( text, containsString( "objectClass: top" ) );
+        assertThat( text, containsString( "objectClass: organizationalUnit" ) );
+        assertThat( text, containsString( "ou: groups" ) );
+
+        assertThat( text, containsString( "#!SEARCH RESULT DONE " ) );
+        assertThat( text, containsString( "# numEntries : 1" ) );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource
+    public void testSearchLogsViewWithSearchResultLogsDisabled( TestLdapServer server ) throws Exception
+    {
+        connectionsViewBot.createTestConnection( server );
+        searchLogsViewBot.clear();
+
+        // disable search request logs
+        searchLogsViewBot.enableSearchRequestLogs( false );
+
+        // select entry (ou=groups)
+        browserViewBot.selectEntry( path( GROUPS_DN ) );
+
+        // assert content
+        assertTrue( searchLogsViewBot.getSearchLogsText().isEmpty() );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource
+    public void testSearchLogsViewClear( TestLdapServer server ) throws Exception
+    {
+        connectionsViewBot.createTestConnection( server );
+
+        assertFalse( searchLogsViewBot.getSearchLogsText().isEmpty() );
+
+        searchLogsViewBot.clear();
+
+        assertTrue( searchLogsViewBot.getSearchLogsText().isEmpty() );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource(mode = Mode.All)
+    public void testSearchLogsViewLogFileRotationAndNavigation( TestLdapServer server ) throws Exception
+    {
+        IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode( ConnectionCoreConstants.PLUGIN_ID );
+        prefs.putInt( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT, 4 );
+        prefs.putInt( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE, 1 );
+        searchLogsViewBot.enableSearchResultEntryLogs( true );
+
+        connectionsViewBot.createTestConnection( server );
+        searchLogsViewBot.clear();
+
+        // initial state: empty log view and older/newer buttons are disabled
+        assertTrue( searchLogsViewBot.getSearchLogsText().isEmpty() );
+        assertFalse( searchLogsViewBot.isOlderButtonEnabled() );
+        assertFalse( searchLogsViewBot.isNewerButtonEnabled() );
+
+        // make some searches
+        browserViewBot.selectEntry( path( USER1_DN ) );
+        browserViewBot.selectEntry( path( USER2_DN ) );
+        browserViewBot.selectEntry( path( USER3_DN ) );
+        browserViewBot.selectEntry( path( USER4_DN ) );
+        browserViewBot.selectEntry( path( USER5_DN ) );
+
+        // assert status of newest page (1)
+        assertTrue( searchLogsViewBot.isOlderButtonEnabled() );
+        assertFalse( searchLogsViewBot.isNewerButtonEnabled() );
+        IntSummaryStatistics requestNumbers1 = getRequestStats( searchLogsViewBot.getSearchLogsText() );
+
+        // go to older page (2) and assert status
+        searchLogsViewBot.clickOlderButton();
+
+        assertTrue( searchLogsViewBot.isOlderButtonEnabled() );
+        assertTrue( searchLogsViewBot.isNewerButtonEnabled() );
+        IntSummaryStatistics requestNumbers2 = getRequestStats( searchLogsViewBot.getSearchLogsText() );
+        assertTrue( requestNumbers1.getMin() >= requestNumbers2.getMin() );
+        assertTrue( requestNumbers1.getMax() >= requestNumbers2.getMax() );
+
+        // go to older page (3) and assert status
+        searchLogsViewBot.clickOlderButton();
+
+        assertTrue( searchLogsViewBot.isOlderButtonEnabled() );
+        assertTrue( searchLogsViewBot.isNewerButtonEnabled() );
+        IntSummaryStatistics requestNumbers3 = getRequestStats( searchLogsViewBot.getSearchLogsText() );
+        assertTrue( requestNumbers2.getMin() >= requestNumbers3.getMin() );
+        assertTrue( requestNumbers2.getMax() >= requestNumbers3.getMax() );
+
+        // go to older page (4) and assert status
+        searchLogsViewBot.clickOlderButton();
+
+        assertFalse( searchLogsViewBot.isOlderButtonEnabled() );
+        assertTrue( searchLogsViewBot.isNewerButtonEnabled() );
+        IntSummaryStatistics requestNumbers4 = getRequestStats( searchLogsViewBot.getSearchLogsText() );
+        assertTrue( requestNumbers3.getMin() >= requestNumbers4.getMin() );
+        assertTrue( requestNumbers3.getMax() >= requestNumbers4.getMax() );
+
+        // go back to newest page (1) and assert status
+        searchLogsViewBot.clickNewerButton();
+        searchLogsViewBot.clickNewerButton();
+        searchLogsViewBot.clickNewerButton();
+
+        assertTrue( searchLogsViewBot.isOlderButtonEnabled() );
+        assertFalse( searchLogsViewBot.isNewerButtonEnabled() );
+
+        // reduce file count and assert extra files were deleted
+        prefs.putInt( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT, 2 );
+
+        assertTrue( searchLogsViewBot.isOlderButtonEnabled() );
+        assertFalse( searchLogsViewBot.isNewerButtonEnabled() );
+        searchLogsViewBot.clickOlderButton();
+        assertFalse( searchLogsViewBot.isOlderButtonEnabled() );
+        assertTrue( searchLogsViewBot.isNewerButtonEnabled() );
+        searchLogsViewBot.clickNewerButton();
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource(mode = Mode.All)
+    public void testSearchLogsViewLogMaskAttributes( TestLdapServer server ) throws Exception
+    {
+        IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode( ConnectionCoreConstants.PLUGIN_ID );
+        prefs.put( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_MASKED_ATTRIBUTES,
+            "userPassword,employeeNumber" );
+        searchLogsViewBot.enableSearchResultEntryLogs( true );
+
+        connectionsViewBot.createTestConnection( server );
+        searchLogsViewBot.clear();
+
+        browserViewBot.selectEntry( path( USER1_DN ) );
+
+        String text = searchLogsViewBot.getSearchLogsText();
+
+        assertThat( text, containsString( "userPassword: **********" ) );
+        assertThat( text, not( containsString( "userPassword:: " ) ) );
+        assertThat( text, containsString( "employeeNumber: **********" ) );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource
+    public void testModificationLogsViewModificationLogsDisabled( TestLdapServer server ) throws Exception
+    {
+        // create and open connection
+        connectionsViewBot.createTestConnection( server );
+        modificationLogsViewBot.clear();
+
+        // disable modification logs
+        modificationLogsViewBot.enableModificationLogs( false );
+
+        makeModifications();
+
+        // assert content
+        assertTrue( modificationLogsViewBot.getModificationLogsText().isEmpty() );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource
+    public void testModificationLogsViewDefault( TestLdapServer server ) throws Exception
+    {
+        // create and open connection
+        connectionsViewBot.createTestConnection( server );
+        modificationLogsViewBot.clear();
+
+        makeModifications();
+
+        // assert content (ou=users)
+        String text = modificationLogsViewBot.getModificationLogsText();
+
+        assertThat( text, containsString( "#!RESULT OK" ) );
+        assertThat( text, containsString( "#!CONNECTION " + server.getLdapUrl() ) );
+        assertThat( text, containsString( "#!DATE " ) );
+        modificationLogsViewBot.assertContainsOk( "dn: " + dn( USERS_DN.getRdn(), TARGET_DN ), "changetype: add" );
+        modificationLogsViewBot.assertContainsOk( "dn: " + dn( USERS_DN.getRdn(), TARGET_DN ), "changetype: delete" );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource
+    public void testModificationLogsViewClear( TestLdapServer server ) throws Exception
+    {
+        connectionsViewBot.createTestConnection( server );
+
+        assertTrue( modificationLogsViewBot.getModificationLogsText().isEmpty() );
+
+        makeModifications();
+
+        assertFalse( modificationLogsViewBot.getModificationLogsText().isEmpty() );
+
+        modificationLogsViewBot.clear();
+
+        assertTrue( modificationLogsViewBot.getModificationLogsText().isEmpty() );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource(mode = Mode.All)
+    public void testModificationLogsViewLogFileRotationAndNavigation( TestLdapServer server ) throws Exception
+    {
+        IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode( ConnectionCoreConstants.PLUGIN_ID );
+        prefs.putInt( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT, 3 );
+        prefs.putInt( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE, 2 );
+
+        connectionsViewBot.createTestConnection( server );
+        modificationLogsViewBot.clear();
+
+        // initial state: empty log view and older/newer buttons are disabled
+        assertTrue( modificationLogsViewBot.getModificationLogsText().isEmpty() );
+        assertFalse( modificationLogsViewBot.isOlderButtonEnabled() );
+        assertFalse( modificationLogsViewBot.isNewerButtonEnabled() );
+
+        makeModifications();
+
+        // assert status of newest page (1)
+        assertTrue( modificationLogsViewBot.isOlderButtonEnabled() );
+        assertFalse( modificationLogsViewBot.isNewerButtonEnabled() );
+        IntSummaryStatistics requestNumbers1 = getRequestStats( modificationLogsViewBot.getModificationLogsText() );
+
+        // go to older page (2) and assert status
+        modificationLogsViewBot.clickOlderButton();
+
+        assertTrue( modificationLogsViewBot.isOlderButtonEnabled() );
+        assertTrue( modificationLogsViewBot.isNewerButtonEnabled() );
+        IntSummaryStatistics requestNumbers2 = getRequestStats( modificationLogsViewBot.getModificationLogsText() );
+        assertTrue( requestNumbers1.getMin() >= requestNumbers2.getMin() );
+        assertTrue( requestNumbers1.getMax() >= requestNumbers2.getMax() );
+
+        // go to older page (3) and assert status
+        modificationLogsViewBot.clickOlderButton();
+
+        assertFalse( modificationLogsViewBot.isOlderButtonEnabled() );
+        assertTrue( modificationLogsViewBot.isNewerButtonEnabled() );
+        IntSummaryStatistics requestNumbers3 = getRequestStats( modificationLogsViewBot.getModificationLogsText() );
+        assertTrue( requestNumbers2.getMin() >= requestNumbers3.getMin() );
+        assertTrue( requestNumbers2.getMax() >= requestNumbers3.getMax() );
+
+        // go back to newest page (1) and assert status
+        modificationLogsViewBot.clickNewerButton();
+        modificationLogsViewBot.clickNewerButton();
+
+        assertTrue( modificationLogsViewBot.isOlderButtonEnabled() );
+        assertFalse( modificationLogsViewBot.isNewerButtonEnabled() );
+    }
+
+
+    @ParameterizedTest
+    @LdapServersSource(mode = Mode.All)
+    public void testModificationLogsViewMaskAttributes( TestLdapServer server ) throws Exception
+    {
+        IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode( ConnectionCoreConstants.PLUGIN_ID );
+        prefs.put( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_MASKED_ATTRIBUTES,
+            "userPassword,employeeNumber" );
+        searchLogsViewBot.enableSearchResultEntryLogs( true );
+
+        connectionsViewBot.createTestConnection( server );
+        modificationLogsViewBot.clear();
+
+        makeModifications();
+
+        String text = modificationLogsViewBot.getModificationLogsText();
+
+        assertThat( text, containsString( "userPassword: **********" ) );
+        assertThat( text, not( containsString( "userPassword:: " ) ) );
+        assertThat( text, containsString( "employeeNumber: **********" ) );
+    }
+
+
+    private void makeModifications()
+    {
+        browserViewBot.selectEntry( path( USERS_DN ) );
+        browserViewBot.copy();
+        browserViewBot.selectEntry( path( TARGET_DN ) );
+        SelectCopyDepthDialogBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyDepthDialog( 1 );
+        dialog.selectSubTree();
+        dialog.clickOkButton();
+        browserViewBot.selectEntry( path( TARGET_DN, USERS_DN.getRdn() ) );
+        browserViewBot.openDeleteDialog().clickOkButton();
+    }
+
+
+    private static IntSummaryStatistics getRequestStats( String text )
+    {
+        Pattern requestNumberPattern = Pattern.compile( "^#!.+\\((\\d+)\\) OK$", Pattern.MULTILINE );
+        Matcher matcher = requestNumberPattern.matcher( text );
+        List<String> matches = new ArrayList<>();
+        while ( matcher.find() )
+        {
+            matches.add( matcher.group( 1 ) );
+        }
+
+        return matches.stream().mapToInt( Integer::parseInt ).summaryStatistics();
+    }
+}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/AbstractLogsViewBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/AbstractLogsViewBot.java
index b879f5a..c25a4cb 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/AbstractLogsViewBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/AbstractLogsViewBot.java
@@ -30,8 +30,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarPushButton;
 public class AbstractLogsViewBot
 {
 
-    private SWTBotView view;
-
+    protected SWTBotView view;
 
     public AbstractLogsViewBot( String title )
     {
@@ -77,4 +76,43 @@ public class AbstractLogsViewBot
 
         } );
     }
+
+
+    public void clear()
+    {
+        view.show();
+        view.toolbarPushButton( "Clear" ).click();
+        new DialogBot( "Delete" )
+        {
+        }.clickOkButton();
+    }
+
+
+    public boolean isOlderButtonEnabled()
+    {
+        view.show();
+        return view.toolbarPushButton( "Older" ).isEnabled();
+    }
+
+
+    public void clickOlderButton()
+    {
+        view.show();
+        view.toolbarPushButton( "Older" ).click();
+    }
+
+
+    public boolean isNewerButtonEnabled()
+    {
+        view.show();
+        return view.toolbarPushButton( "Newer" ).isEnabled();
+    }
+
+
+    public void clickNewerButton()
+    {
+        view.show();
+        view.toolbarPushButton( "Newer" ).click();
+    }
+
 }
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java
index 397b9b9..3c065cd 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java
@@ -31,6 +31,7 @@ import org.apache.directory.studio.ldifparser.model.LdifFile;
 import org.apache.directory.studio.ldifparser.model.container.LdifCommentContainer;
 import org.apache.directory.studio.ldifparser.model.container.LdifContainer;
 import org.apache.directory.studio.ldifparser.parser.LdifParser;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
 
 
 public class ModificationLogsViewBot extends AbstractLogsViewBot
@@ -47,6 +48,16 @@ public class ModificationLogsViewBot extends AbstractLogsViewBot
     }
 
 
+    public void enableModificationLogs( boolean b )
+    {
+        view.show();
+        SWTBotMenu menuItem = view.viewMenu( "Enable Modification Logs" );
+        if ( menuItem.isChecked() != b )
+        {
+            menuItem.click();
+        }
+    }
+
     public void assertContainsOk( String... lines )
     {
         List<String> parts = new ArrayList<>();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java
index dd69410..f742c53 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java
@@ -20,6 +20,9 @@
 package org.apache.directory.studio.test.integration.ui.bots;
 
 
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+
+
 public class SearchLogsViewBot extends AbstractLogsViewBot
 {
     public SearchLogsViewBot()
@@ -32,4 +35,26 @@ public class SearchLogsViewBot extends AbstractLogsViewBot
     {
         return super.getLogsText();
     }
+
+
+    public void enableSearchRequestLogs( boolean b )
+    {
+        view.show();
+        SWTBotMenu menuItem = view.viewMenu( "Enable Search Request Logs" );
+        if ( menuItem.isChecked() != b )
+        {
+            menuItem.click();
+        }
+    }
+
+
+    public void enableSearchResultEntryLogs( boolean b )
+    {
+        view.show();
+        SWTBotMenu menuItem = view.viewMenu( "Enable Search Result Entry Logs (!)" );
+        if ( menuItem.isChecked() != b )
+        {
+            menuItem.click();
+        }
+    }
 }