Log Station

Log Station allows a PLC to send log messages to Viper.NET, which can then be written to files or displayed in the GUI, depending on Log configuration.

The communication to the controller is realized via a digital handshake, see also Stations.

To set up the Log Station, first create required data, bits and variables in GInOut and customize the configuration file stations.xml.

<station id="1" name="Log 1" type="LogStation">
  <param name="logger" value="PLC"/>
  <param name="setBusyWithData" value="Auto"/>
    <param name="wait4NegEdgeTriggerTO" value="-1"/>
      <bit bitRef="1101" id="trigger"/>
      <bit bitRef="1101" id="ready"/>
      <bit bitRef="1102" id="busy"/>
      <bit bitRef="1103" id="error"/>
      <bit bitRef="1104" id="io"/>
      <bit bitRef="1105" id="nio"/>
      <data dataRef="1101" offset="0" length="128" id="DATA"/>
      <data varRef="VarsLogStation.InCmd" id="cmd"/>
      <data varRef="VarsLogStation.InMsg" id="msg"/>

The handshake and the parameterization correspond as far as possible to the Viper.NET Standard station.

  • cmd: Log level selection. 0/1:Debug, 2:Info, 3:Warn, 4:Error, 5:Fatal

  • msg: Log message, or the text to log.

  1. Handshake Bits

  2. Handshake variables

  3. GAppender Log Window

Log4net.config Template

<!-- PLC log -->
<appender name="GAppenderPLC" type="Gefasoft.MAK.Logging.GBufferAppender">
  <param name="BufferSize" value="10000000"/>
  <param name="DumpFile" value="D:/log/LogStation-PLC_Dump.log" />
  <param name="MaxSizeRollBackups" value="3" />
  <param name="MaxCharsToDisplay" value="100000"/>
  <param name="DisplayName" value="PLC"/>
  <param name="SortId" value="1"/>
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%d %-5p - %m%n" />
  <AutoDumpSettings type="Gefasoft.MAK.Logging.GAppenderAutoDumpSettings">
    <param name="DumpFile" value="D:/log/LogStation-PLC_AutoDump.log" />
    <param name="MaxSizeRollBackups" value="10" />
    <param name="DumpSize" value="1000000"/>
    <param name="TriggerPattern" value="regex:"/>
    <param name="LogLevel" value="OFF"/>
    <param name="AdditionalAppenderToAutodump" value ="" />

<appender name="FileAppenderPLC" type="log4net.Appender.RollingFileAppender">
  <param name="File" value="D:/log/LogStation-PLC.log" />
  <param name="AppendToFile" value="true" />
  <param name="MaxSizeRollBackups" value="10" />
  <param name="RollingStyle" value="Size" />
  <param name="MaximumFileSize" value="10MB" />
  <param name="StaticLogFileName" value="true" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%d %-5p - %m%n" />

<logger name="PLC" additivity="False">
  <level value="DEBUG" />
  <appender-ref ref="FileAppenderPLC" />
  <appender-ref ref="GAppenderPLC"/>