Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
in CompleteFTP by (46.8k points)
We're sometimes asked how CompleteFTP can be configured to log to the Windows event log.

In fact, CompleteFTP already logs some messages to the Windows event log, but as of version 8.2.1 this is not done very consistently with only a few types of messages being logged. It is however possible to improve it by modifying a configuration file.

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

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 Event 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.