Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
1.2k views
in CompleteFTP by (51.2k points)
edited by

We're sometimes asked how CompleteFTP can be configured to log to the Windows event log.

CompleteFTP's sophisticated logging system is based on log4net. log4net is highly configurable. If modifications are to be made to the log4net configuration then the full log4net configuration should be placed into a file called LogConfig.xml, which should be placed in the directory, C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Logs. This will prevent changes from being overwritten when CompleteFTP is upgraded. The default log4net configuration may be found in C:\Program Files (x86)\Complete FTP\Server\CompleteFTPService.exe.config. The XML node, <log4net>, and all of its sub-nodes, should be copied into the LogConfig.xml file and used as a basis for a new configuration.

The next step is to a logging appender that directs messages to the Windows event log. This can be done by adding the following block alongside the existing <appender> elements:

<!-- Windows event log appender -->
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
   <param name="ApplicationName" value="CompleteFTP" />
   <filter type="log4net.Filter.LevelRangeFilter">
      <param name="LevelMin" value="ERROR"/>
      <param name="LevelMax" value="ERROR"/>
   </filter>
   <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
   </layout>
</appender>


Next you need to make sure that the appender is actually used. To do this add the following element inside the <root> element:

<appender-ref ref="EventLogAppender" />

Once CompleteFTP is restarted it will start logging errors to the Windows Application Log.

To view these errors, open the Event Viewer and select the 'Windows Logs/Application' item in the tree. CompleteFTP messages will be recorded with the source as 'CompleteFTP'. You may like to create a custom view specifically for CompleteFTP. To do this, click 'Create custom view' and select 'CompleteFTP' as the Event Source. Once you've done that you should see a CompleteFTP entry under the 'Custom Views' node in the tree.

Please log in or register to answer this question.

Categories

...