Product DocsMenu

Coveo Platform 7.0 >
Administrator Help > Troubleshooting > Logging Information With log4net

Logging Information With log4net

Coveo Enterprise Search (CES) modules such as connectors take advantage of the Apache log4net library to allow you to gather detailed information about the process. Logging such information may be very useful while troubleshooting CES issues.

The typical scenario to use log4net is when you open a case with Coveo Support to resolve an issue and more process troubleshooting information is needed. The Coveo support agent sends you or recommends a sample log4net configuration file to use to gather the required information.

How log4net Works

When a CES module supporting log4net runs and an XML file with the .log4net extension and the same full name as the module executable exists, the module gets the log4net configuration from this file, and then outputs corresponding information.

The log4net configuration file does not have to exist when you start your CES. Log4net watches for any new file created in the folder so simply creating the .log4net configuration file triggers the update within the component that is logging. When using a file appender, the destination folder does not have to exist. Log4net creates the folder.

To log information with log4net

  1. Using an administrator account, connect to the Coveo Master server.

  2. Using a text editor:

    1. Open the log4net configuration file that you received from Coveo Support or a sample log4net configuration file appropriate for the CES module for which you want to log information.

      Note: CES 7.0.7104+ (October 2014) The following sample log4net configuration files are available from the [CES_Path]\bin\Log4Net Samples\ folder: 

      • CESCustomCrawlers7.exe.log4net

        To log information from connector (crawler) processes.

      • Coveo.CNL.HostProcess.exe.log4net

        To log information from the child processes launched by some connectors such as the Database connector.

      • Coveo.Cdf.NodeProcess.exe.log4net

        To log information from the security provider processes.

    2. In the file, edit the lines that typically need to be customized: 

      Example: The following is a typical content of a sample log4net configuration file for a connector.

      <log4net>
          <!-- RollingFileAppender - Use for long lasting logging sessions -->
          <!-- NOTE : DO NOT FORGET TO CHANGE THE LOG PATH -->
          <!-- NOTE : If you think that a lot of logs will be generated, change the maxSizeRollBackups value -->
          <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
              <file value="C:\Temp\Crawler.logs" /> <!-- Change this if necessary -->
              <appendToFile value="true" />
              <rollingStyle value="Size" />
              <maxSizeRollBackups value="10" />
              <maximumFileSize value="50MB" />
              <staticLogFileName value="true" />
              <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
              <layout type="log4net.Layout.PatternLayout">
                  <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
              </layout>
          </appender>
          
          <!-- Example logger -->
          <!-- NOTE : To activate a logger, you need to specify the name and uncomment the following lines -->
          <!-- 
          <logger name="Coveo.CES.CustomCrawlers.MyCrawler">
              <level value="DEBUG" />
              <appender-ref ref="RollingFileAppender" />
          </logger>
          -->
      </log4net>
      • In the appender section, ensure that the output file value points to an appropriate drive, folder, and file name.

        Example: When want to log crawling information in the C:\Temp\ folder: 

        <file value="C:\Temp\Crawler.logs" />
      • In the logger section, ensure that the name attribute contains the appropriate namespace. Contact Coveo Support for assistance when you do not know the namespace.

        Example: When you want to see what happens with the connection to Google Drive for a source, you can use the CESCustomCrawlers7.exe.log4net sample file with the following logger section: 

        <logger name="Coveo.Connectors.GoogleDrive.Connection">
          <level value="DEBUG" />
          <appender-ref ref="RollingFileAppender" />
        </logger>
      • When the logger section is commented, remove the commenting markers <!-- --> around it to activate the logging.

      Note: For more information on the syntax of the log4net configuration file, refer to the Apache log4net documentation, or contact Coveo Support.

    3. Save the file in the [CES_Path]\bin\ folder.

  3. Ensure that the CES module for which you are collecting logs performs the actions you want to log.

  4. Open the log file to review the logs.

  5. Once you got the information that you want, deactivate the logging using one of the following methods:

    • Rename the log4net configuration file.

      Example: You can add the .DISABLED extension to the file to indicate its state.

      [CES_Path]\bin\CESCustomCrawlers7.exe.log4net.DISABLED

      When you want to restart logging similar information, you only need to remove the .DISABLED extension.

      OR

    • Move the log4net configuration file to another folder such as [CES_Path]\bin\Log4Net Samples\.

      OR

    • Delete the log4net configuration file.

      OR

    • Using a text editor open the log4net configuration file in the [CES_Path]\bin\ folder, and comment all the logger sections by adding commenting markers <!-- --> around them, and then save the file.

    Important: It is not recommended to leave active log4net logging for long periods as this process can slow down the CES module that is outputting the logs.

People who viewed this topic also viewed