Post by darko7417 on When running as a service, CodesysControl doesn't write log files to the disk (and other CmpLog related issuess)
CODESYS Forge
talk
(Post)
I run CODESYS runtime as a service and use CmpLog (the LogAdd2 function) to log different events to a file. I have done this many times before on various projects and hardware, and it works fine. On this particular system, I have CODESYS 3.5.20.40 running on a Windows 11 PC. The CODESYSControlService autostarts (with Local System credentials, the default), and the application runs fine. However, the configuration file is not read (or at least not the one that should be, or not the CmpLog section), and log files are not written to the disk. I would be thankful if anyone knew why this is happening and how to fix it. A note to CODESYS people: you must provide more information on the codesys configuration file, CODESYSControlService.exe and other major components and system behaviour. You created the service and various features (i.e. logging), but haven't explained how they work, which, in my opinion, is below standard for industrial automation software. These are my observations: - When running as a service, the config file is not read (none of them), or at least the CmpLog section is not read. I checked the log using Codesys IDE, and the CmpLog parameters are not the ones I have set in any of the config files. Which CmpLog config values does the service use, and where does it read them from? I have no idea, but it's not the config files. Here are the codesys config files I located on the PC's disk: o C:\Program Files (x86)\CODESYS 3.5.20.40\GatewayPLC\CODESYSControl.cfg (only 2 lines in this config) o C:\Program Files (x86)\CODESYS 3.5.20.40\GatewayPLC\AppDataFiles\CODESYSControlWinV3\CODESYSControl.cfg o C:\Users\SRV\AppData\Roaming\CODESYS\CODESYSControlWinV3\C4DBB537\CODESYSControl.cfg o C:\Program Files (x86)\CODESYS 3.5.20.40\GatewayPLC\tempCFG\CODESYSControl.cfg - When I run codesys as an app (e.g. by clicking the icon), this config file is read C:\Users\SRV\AppData\Roaming\CODESYS\CODESYSControlWinV3\C4DBB537\CODESYSControl.cfg and log files are written ok. The icon target is "C:\Program Files (x86)\CODESYS 3.5.20.40\GatewayPLC\CODESYSControlService.exe" -d o the -d option, I think, starts a cmd-like window showing service debug output (the output shown in log in the IDE) o the -i option, again I think, means install the service - I tried adding -d to service start parameters in the registry, but it started only once and after that it refused to start. Knowing what -d does and which other options are available would be great (e.g. can I make the service read a different config file). - Syslog UDP logging works fine in any case. - These are my CmpLog parameters ~~~ [CmpLog] Logger.0.Name=PlcLog3 Logger.0.Filter=0xFFFFFFFF Logger.0.Enable=1 Logger.0.MaxEntries=10003 Logger.0.MaxFileSize=50003 Logger.0.MaxFiles=33 Logger.0.Backend.0.ClassId=0x0000010B ;sends logger messages to SysOut Logger.0.Backend.1.ClassId=0x00000104 ;writes logger messages in a file Logger.0.Backend.2.ClassId=0x00000135 ;sends logger messages as UDP syslog Logger.0.Type=0x314 ;Set the timestamp to RTC ~~~
Last updated: 2025-02-27
Raspberry Model A+ doesn't work
CODESYS Forge
talk
(Thread)
Raspberry Model A+ doesn't work
Last updated: 2017-02-28
Lock usb port to a device
CODESYS Forge
talk
(Thread)
Lock usb port to a device
Last updated: 2017-06-07
programming a font change
CODESYS Forge
talk
(Thread)
programming a font change
Last updated: 2018-06-01
Visu Style in a library
CODESYS Forge
talk
(Thread)
Visu Style in a library
Last updated: 2016-09-20
Creating a Custom Automation Plattform
CODESYS Forge
talk
(Thread)
Creating a Custom Automation Plattform
Last updated: 2023-06-03
Dinamic assignement of a variable
CODESYS Forge
talk
(Thread)
Dinamic assignement of a variable
Last updated: 2016-06-28
Interface member in a FB
CODESYS Forge
talk
(Thread)
Interface member in a FB
Last updated: 2018-05-15
Logging to a SoftPLC remotely?
CODESYS Forge
talk
(Thread)
Logging to a SoftPLC remotely?
Last updated: 2020-10-02
Sinnvolle Benennung der E/A Ebene
CODESYS Forge
talk
(Thread)
Sinnvolle Benennung der E/A Ebene
Last updated: 2012-03-18
First IO address of a CAADiagDeviceDefault.
CODESYS Forge
talk
(Thread)
First IO address of a CAADiagDeviceDefault.
Last updated: 2024-08-22
First IO address of a CAADiagDeviceDefault.
CODESYS Forge
talk
(Thread)
First IO address of a CAADiagDeviceDefault.
Last updated: 2024-08-22
Configuring a 2's compliment
CODESYS Forge
talk
(Thread)
Configuring a 2's compliment
Last updated: 2024-09-28
Bought a license, but can't activate
CODESYS Forge
talk
(Thread)
Bought a license, but can't activate
Last updated: 2024-10-11
A method in the Task Configurator
CODESYS Forge
talk
(Thread)
A method in the Task Configurator
Last updated: 2025-01-23
Programmatically change Tappet on a cam
CODESYS Forge
talk
(Thread)
Programmatically change Tappet on a cam
Last updated: 2025-04-02
Cursor to move to a control
CODESYS Forge
talk
(Thread)
Cursor to move to a control
Last updated: 2025-08-12
Execute a .py file with Codesys
CODESYS Forge
talk
(Thread)
Execute a .py file with Codesys
Last updated: 2025-09-03
running a project automaticlly
CODESYS Forge
talk
(Thread)
running a project automaticlly
Last updated: 2011-05-26
Characters inside a string type.
CODESYS Forge
talk
(Thread)
Characters inside a string type.
Last updated: 2012-03-26
Assign a 12 Byte Hex
CODESYS Forge
talk
(Thread)
Assign a 12 Byte Hex
Last updated: 2021-09-09
Backup variable to a file.
CODESYS Forge
talk
(Thread)
Backup variable to a file.
Last updated: 2009-06-29
RasPi as a modbus slave
CODESYS Forge
talk
(Thread)
RasPi as a modbus slave
Last updated: 2017-02-19
Variable values into a string
CODESYS Forge
talk
(Thread)
Variable values into a string
Last updated: 2010-02-08
Codesys WebVisu like a HMI
CODESYS Forge
talk
(Thread)
Codesys WebVisu like a HMI
Last updated: 2022-02-03
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND or OR.